CARDS & DECORATION
ColorPicker
Native <input type="color"> swatch paired with the design-system Input for a hex string. Both controls share a single value / onChange — the parent decides whether to validate the hex.
Import
Basic — swatch + hex input
Hide the hex input
Hide the visible label
aria-label is preserved on both controls, so the component remains accessible even when the visible label is hidden.
Props
ColorPicker props
| Prop | Type | Default | Description |
|---|---|---|---|
| label* | string | — | Visible label rendered above the controls. Also used as the aria-label on the swatch + hex input. |
| value* | string | — | Current color string. Pass any value the consumer expects (typically a hex). |
| onChange* | (next: string) => void | — | Fires whenever the swatch or the hex input emits a new value. Validate the string before re-binding it to state. |
| showInput | boolean | true | Hide the hex text input and show only the color swatch. |
| showLabel | boolean | true | Hide the visible label — aria-label is still wired for screen readers. |
| id | string | — | Override the auto-generated id used to wire the label and the color input. |
Accessibility
- Both the native swatch and the paired hex
Inputreceive anaria-labelderived from thelabelprop, so screen readers announce the control's purpose even when the visible label is hidden. - The swatch gets the standard
focus-visiblering used across the lib; keyboard users tabbing into the field see a clear focus indicator before opening the OS color picker.