How to build an accessible ColorPicker in React

The saturation/lightness area is a focusable role="slider" with arrow-key nudging and an aria-valuetext reporting the current hex; hue and alpha are native range inputs that inherit platform slider semantics and announcements.

When to use a ColorPicker

When not to use it

Keyboard interactions

Role slider, verified at WCAG 2.2-AA.

Common mistakes

Avoid: <ColorPicker /> with no presets for a brand palette of 4 fixed colors

Prefer: <RadioGroup> of color swatches

A free-form picker invites off-brand values when only a fixed set is allowed

Example

<ColorPicker defaultValue="#3b82f6" onValueChange={setColor} />

See the full ColorPicker reference →