liveBook · Manning

Coordinate picker

As explained in Web Components in Action

A coordinate picker is a two-dimensional user-interface control for selecting values by dragging along horizontal and vertical axes.

A coordinate picker is a two-dimensional control for selecting values along horizontal and vertical axes. Dragging horizontally changes saturation; dragging vertically changes brightness. Unlike a slider, it tracks two percentage values, x and y, while its thumbnail moves in both directions. section 11.1 section 11.2

Minimal coordinate picker demo

Load the component as an ES module, size the custom element, and provide an initial background color: <wcia-coord-picker backgroundcolor="#ff0000"></wcia-coord-picker>. A 400-by-400 element gives the x and y percentages visible room for dragging.

Figure 11.5. Saturation and brightness picker as a candidate for a web component

Use the saturation-and-brightness picker figure to connect the two-axis interaction with the component’s color-selection role. section 11.1

How Web Components in Action covers it

How deep it goes
Explains attributes, event handling, coordinate normalization, clamping, rendering, and CSS overlays, while deferring library-based reflection utilities.
Examples
Demonstrates saturation and brightness selection, gradient overlays, draggable thumbnails, and a custom-element demo page.
What it assumes
Assumes familiarity with slider behavior and JavaScript classes while demonstrating the component’s DOM structure and interaction logic.
What you can do after
Build from scratch a draggable coordinate picker custom element with reflected x and y attributes and bounded thumbnail movement.
How it connects
Connects Web Components with custom elements, Shadow DOM, DOM events, CSS gradients, sliders, and color pickers.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Web Components in Action. The section links point to the parts of the book it draws on.