Skip to content

ColorSwatchPicker

A controlled swatch picker for choosing one named theme color.

Office colorChoose the named theme color used for this office.
<ColorSwatchPicker
label="Office color"
description="Choose the named theme color used for this office."
size="md"
value="blue"
/>
Office colorChoose the named theme color used for this office.
Office colorChoose the named theme color used for this office.
Office colorChoose the named theme color used for this office.
<SizesStory {...args} />
Office colorChoose the named theme color used for this office.
<ColorSwatchPicker
label="Office color"
description="Choose the named theme color used for this office."
size="md"
value="green"
colors={['red', 'orange', 'green', 'blue', 'purple']}
/>
Office colorHover a swatch to see the grow effect.
<ColorSwatchPicker
label="Office color"
description="Hover a swatch to see the grow effect."
size="md"
value="purple"
/>
Office colorChoose the named theme color used for this office.
<ColorSwatchPicker
label="Office color"
description="Choose the named theme color used for this office."
size="md"
value="blue"
isDisabled
/>
Office colorChoose the named theme color used for this office.
<ColorSwatchPicker
label="Office color"
description="Choose the named theme color used for this office."
size="md"
value="blue"
status={{message: 'Choose an office color.', type: 'error'}}
/>
Office colorRequiredChoose the named theme color used for this office.
<ColorSwatchPicker
label="Office color"
description="Choose the named theme color used for this office."
size="md"
value="blue"
isRequired
/>
Office colorChoose the named theme color used for this office.
North officeNorth office
<DrivesOtherComponentsStory {...args} />

A controlled swatch picker for choosing one named theme color.

When isOptional: false, isRequired: false

PropTypeDefaultDescription
classNamestringAdditional CSS class names applied to the field root.
colorsReadonlyArray<ColorName>COLOR_NAMESPalette colors to render, in display order.
data-testidstringTest ID applied to the field root.
descriptionReactNodeSupporting text displayed below the label.
isDisabledbooleanfalseWhether all swatches are disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
label*stringLabel text for the swatch picker.
labelTooltipReactNodeTooltip content shown next to the label.
onChange*(value: ColorName) => voidCallback fired when the selected color changes.
refRef<HTMLDivElement>Ref forwarded to the field root.
size"sm" | "md" | "lg"'md'Size of the swatches.
statusInputStatusValidation status displayed below the picker.
styleCSSPropertiesInline styles applied to the field root.
value*"red" | "orange" | "yellow" | "green" | "teal" | "cyan" | "blue" | "purple" | "pink" | "gray"The currently selected color.
isOptionalfalse
isRequiredfalse

When isOptional: true, isRequired: false

PropTypeDefaultDescription
classNamestringAdditional CSS class names applied to the field root.
colorsReadonlyArray<ColorName>COLOR_NAMESPalette colors to render, in display order.
data-testidstringTest ID applied to the field root.
descriptionReactNodeSupporting text displayed below the label.
isDisabledbooleanfalseWhether all swatches are disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
label*stringLabel text for the swatch picker.
labelTooltipReactNodeTooltip content shown next to the label.
onChange*(value: ColorName) => voidCallback fired when the selected color changes.
refRef<HTMLDivElement>Ref forwarded to the field root.
size"sm" | "md" | "lg"'md'Size of the swatches.
statusInputStatusValidation status displayed below the picker.
styleCSSPropertiesInline styles applied to the field root.
value*"red" | "orange" | "yellow" | "green" | "teal" | "cyan" | "blue" | "purple" | "pink" | "gray"The currently selected color.
isOptional*true
isRequiredfalse

When isOptional: false, isRequired: true

PropTypeDefaultDescription
classNamestringAdditional CSS class names applied to the field root.
colorsReadonlyArray<ColorName>COLOR_NAMESPalette colors to render, in display order.
data-testidstringTest ID applied to the field root.
descriptionReactNodeSupporting text displayed below the label.
isDisabledbooleanfalseWhether all swatches are disabled.
isLabelHiddenbooleanfalseWhether to visually hide the label.
label*stringLabel text for the swatch picker.
labelTooltipReactNodeTooltip content shown next to the label.
onChange*(value: ColorName) => voidCallback fired when the selected color changes.
refRef<HTMLDivElement>Ref forwarded to the field root.
size"sm" | "md" | "lg"'md'Size of the swatches.
statusInputStatusValidation status displayed below the picker.
styleCSSPropertiesInline styles applied to the field root.
value*"red" | "orange" | "yellow" | "green" | "teal" | "cyan" | "blue" | "purple" | "pink" | "gray"The currently selected color.
isOptionalfalse
isRequired*true