Color Picker

A wrapping grid of colour chips with arrow-key roving focus, a native custom-colour tile and an optional hex field.

tsx
import { ColorPicker, ColorSwatch } from "@pestoui/core"

Palette

Uncontrolled — the picker holds its own value. The dashed tile opens the OS colour dialog for anything outside the palette.

Controlled with a hex field

Pass value and onValueChange to own the state. showInput adds a preview tile and a hex input that accepts the #rgb shorthand.

Swatch sizes

ColorSwatch on its own — a squircle button that carries the fill in style, never in a class.

Props

PropTypeDefaultDescription
valuestring—Controlled hex value. Omit it to let the picker manage its own.
defaultValuestringcolors[0]Starting hex when uncontrolled.
onValueChange(hex: string) => void—Fires with the six-digit hex on every commit — chip, custom tile or a valid hex typed into the field.
colorsstring[]12 defaultsThe palette offered as chips. Any CSS colour string works.
showCustombooleantrueAppend the dashed tile that opens the native colour input.
showInputbooleanfalseShow the preview tile and hex field below the grid.
size"sm" | "default" | "lg""default"Chip size — set on ColorPicker for the whole grid, or on a lone ColorSwatch.
colorstring—ColorSwatch only — the fill, applied as an inline background.
selectedbooleanfalseColorSwatch only — draws the selected-green ring and check disc, and sets aria-pressed.
onSelect(color: string) => void—ColorSwatch only — called with the chip's colour unless the click handler prevented default.
labelstringcolorColorSwatch only — accessible name and tooltip; falls back to the hex string.

Pesto UI · 117 documented components