Color Picker

The Color Picker component allows users to select a color from predefined options or optionally provide a custom value.

Usage

Default

Choose a color
<ColorPicker 
  colors={[
    { label: "Red", value: "#e63946" },
    { label: "Green", value: "#2a9d8f" },
    { label: "Blue", value: "#457b9d" },
    { label: "Yellow", value: "#f4a261" },
  ]}
  selected={selected}
  onChange={setSelected}
/>

Props

Sortable data table
PropTypeDefaultDescription
labelstring"Choose a color"Accessible label for the color picker.
colors{ label: string; value: string; }[]-Array of color options for the picker.
selectedstring-Currently selected color value.
onChange(color: string) => void-Callback fired when a color is selected.
namestring"color-picker"Name attribute for form integrations.
disabledbooleanfalseDisables the color picker.
size"xs" | "small" | "medium" | "large" | "xl"Configured DefaultSize of the color swatches and controls.
shape"square", "round", "pill""round"Shape of the color swatches.
shadow"none" | "light" | "medium" | "strong" | "intense"Configured DefaultShadow style for the color swatches.
allowCustombooleanfalseAllows the user to input a custom color value.
classNamestring-Additional CSS classes for the container.
data-testidstring"color-picker"Test ID for targeting the component in tests.