Color Picker
betaPick a colour from a saturation square, hue and alpha sliders, a hex/rgb/oklch field, swatches or the screen — with a live WCAG contrast reading.
- Forms
- 2 files
- No extra npm packages
- Accessibility notes
pnpm dlx @dowel-ui/cli add color-pickerNo npm packages are needed beyond what Dowel already requires.
import { ColorPicker } from "@/components/ui/color-picker";Default
Alpha And Oklch
In APopover
<ColorPicker>
| Prop | Type | Default |
|---|---|---|
alphaOffer an alpha slider. Default false. | boolean | false |
contrastWithA colour to measure contrast against — a background, usually. A theme token ("background") or any CSS colour. Shows the WCAG ratio and level. | string | — |
defaultValueThe colour it starts on, uncontrolled. | string | DEFAULT_COLOR |
disabled | boolean | false |
eyeDropperShow the eyedropper button where the browser supports it. Default true. | boolean | true |
formatHow | ColorFormat | "hex" |
labelNames the picker's controls, e.g. "Brand colour". Default "Colour". | string | "Colour" |
onValueChangeCalled with the colour written in | (value: string) => void | — |
swatchesColours offered as one-click swatches. | readonly string[] | — |
valueThe colour, controlled, in any format the field accepts. | string | — |
Plus every attribute of <div> except defaultValue, onChange.
9/9
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — passes
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — does not apply
- className merged — passes
- Visible focus — passes
- No fixed widths — passes