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

Data table
TypeDescription
allowCustombooleanIf true, allows picking a custom color via a color input.
aria-describedbystringReferences one or more elements that describe the group. This will be merged with helperText / errorText IDs when provided.
aria-labelstringAccessible name for the group when no visible label should be used or when a more descriptive label is needed.
aria-labelledbystringReferences an external element that labels the group. Prefer this when the visible label exists outside the component.
classNamestringCustom class name for the component container.
colorsColorOption[]Array of color options to choose from.
customInputAriaLabelstringOptional label for the custom color input.
data-testidstringOptional test ID for testing frameworks.
disabledbooleanWhether the entire picker is disabled.
errorTextstringOptional error message shown when invalid.
helperTextstringOptional helper text shown below or associated with the picker.
hideLabelbooleanHide the visible legend visually while preserving it for screen readers.
invalidbooleanMarks the group as invalid.
labelstringOptional visible label above the color group.
namestringOptional name attribute for the radio group.
onChange(color: string) => voidCallback triggered when a color is selected.
requiredbooleanMarks the group as required.
selectedstringCurrently selected color value.
shadowShadowTypeApplies a shadow effect to the swatches ('none' | 'light' | 'medium' | 'strong' | 'intense').
shapeShapeTypeShape of the swatches ('square' | 'round' | 'pill').
sizeSizeTypeSize of the swatches ('xs' | 'small' | 'medium' | 'large' | 'xl').