Let's build a colour picker web component using HTML, CSS, and a little bit of JavaScript. In the end, we'll have a custom element that:
- Displays a colour spectrum using CSS Gradients
- Tracks the mouse position using a Reactive Controller
- Updates it's Shadow DOM via a small class mixin
- Fires a Custom Event when the user clicks or drags
Contents
Prerequisites
To get the most out of this article, you should have a comfortable understanding of HTML, CSS, and JavaScript; including:
- How to load resources with
<link>
- Basic CSS syntax
- How to use the DOM API to query for elements
- Object-oriented programming for web developers…