Skip to content

ColorPicker

Native color well plus an editable hex field and optional preset swatches, all two-way synced. The hex text input carries the form name, so the value submits natively.

Example

<ColorPicker
  id="theme-color"
  label="Theme color"
  name="theme-color"
  presets={["#4f46e5", "#16a34a", "#dc2626"]}
/>

Props

PropTypeDefaultDescription
idstring-Required. Base for the hex input id and message ids.
labelstring-Visible label; also names the picker and preset group.
namestringidHex input form name.
valuestring#4f46e5Initial #rrggbb color.
presetsstring[][]Swatch colors; each renders a Use color … button.
hintstring-Help text below the control.
errorstring-Error message; sets aria-invalid on the hex input.
disabledbooleanfalseNon-interactive.
classstring-Style passthrough.

Accessibility