ColorPicker

Interactive color selection widget with saturation/lightness area, hue and alpha sliders

Category: inputs · WCAG 2.2-AA · color, input, form, picker, hue, alpha

Sizes

States

Props

PropTypeDefaultDescription
labelsColorPickerLabelsOverrides for the component’s user-visible strings (i18n).
valuestringControlled hex color value
defaultValuestring#3b82f6The initial value when uncontrolled.
onValueChange(value: string) => voidCalled with the new value when it changes.
presetsstring[]Preset swatch colors
alphabooleantrueWhen true, enables alpha (opacity) selection.
format'hex' | 'rgb' | 'hsl''hex'Notation for the emitted value. Alpha is included whenever alpha is on, so the emitted string has a stable width.
namestringSubmitted with a surrounding form — a hidden input carrying the current value.
labelstringText label for the control.
disabledbooleanfalseWhen true, disables the control and removes it from the tab order.
size'sm' | 'md' | 'lg'mdVisual size of the component (e.g. 'sm', 'md', 'lg').
aria-labelledbystringWired automatically by a wrapping `Field` — its label id, forwarded to the focusable control so the Field's label names it.
aria-describedbystringWired automatically by a wrapping `Field` — the ids of its hint/error text, forwarded to the focusable control so the supporting text is announced.
aria-invalidbooleanWired automatically by a wrapping `Field` when it is in an error state.
idstringId for the **focusable control** (not the wrapper), so a `<label for>` names what actually takes focus. `Field` supplies this automatically.
ariaLabelstringInvisible accessible name, for when a visible element outside this component already labels it and `label` would render that text a second time. ⚠ `label` on this component is **visible**; `IconButton.label`/`Sparkline.label` are invisible names, which is the prior that costs adopters a duplicated label. The raw DOM `aria-label` still wins over this.

Design tokens

When to use

When not to use

How to build an accessible ColorPicker in React →

Examples

Basic

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

With presets

<ColorPicker presets={["#ef4444", "#3b82f6", "#10b981"]} alpha={false} />

Related components

← Back to docs