Skip to content
Preview
PreviewChoose a hue for a label.
Label color
Design review

ColorPicker

valuerequired
`#${string}`
The colour, #rrggbb.
onChangerequired
(color: `#${string}`) => void
Each colour as it is set, #rrggbb: every step of a drag or a key, a whole hex typed, a swatch chosen.
swatches
readonly Ink[]
Default: INKS
Colours to start from, a row of swatches under the rest. Default the marking inks; [] for none.
label
string
Default: "Color"
Its name for assistive technology.
onEyedrop
() => void
Picking a colour from the screen: a pipette beside the hex, which hands back to this instead of opening the browser's own picker.
rootStyle
RootStyle<ColorPickerKnobs>
Typed StyleX override: layout and --color-picker-area-h.

Rest props go to <div> props.

color
string
The colour it shows, #rrggbb or a token's var(). Omit for the monochrome default (a hollow ring). With onPick, the colour last picked (#rrggbb), shown in its middle while it is selected.
labelrequired
string
Required: its name, which is its accessible name and its tooltip.
selected
boolean
It is the colour chosen: an ink ring round it. Where travelRow joins the swatches, the ring travels from the swatch chosen before on a pointer's pick, and lands whole from the keyboard, a wrap or reduced motion; without it, no ring travels. As a radio, aria-checked; else aria-pressed.
onPick
(color: `#${string}`) => void
Any other colour: a wheel of hues that opens a ColorPicker in a popover, handing back each colour picked.
onEyedrop
() => void
Picking a colour from the screen: the picker's pipette closes the popover and hands back to this instead of opening the browser's own picker.
size
"sm" | "md" | "lg"
Default: "lg"
sm 24, md 28, lg 32.
tooltip
false
false: no tooltip, where its name already stands beside it.
travelRow
object
The row of one choice it belongs to, so the chosen ring travels within it on a pointer pick. Give every swatch of one row the same stable object; without one, no ring travels between swatches.
rootStyle
RootStyle
Typed StyleX override: layout.

Rest props go to <button> props.

valuerequired
LabelHue
The hue chosen.
onChangerequired
(hue: LabelHue) => void
size
"sm" | "md" | "lg"
Default: "sm"
rootStyle
RootStyle
Typed StyleX override: where the row sits.

Rest props go to <fieldset> props.

State machine

PreviewChoose a marking color.
Swatches