ColorSwatches API

API reference docs for theColorSwatchescomponent. For examples and details on the usage of this component, visit the component demo page.

Props

PropsTypeDescriptionDefault
ariaLabelPrefix?stringUsed as a prefix for the aria-label of each swatch_
colorsstring[]A list of colors (hex codes) for the user to pick from_
customFirstSwatch?ReactNodeAllows the consumer to provide a custom element for the first swatch_
customLastSwatch?ReactNodeAllows the consumer to provide a custom element for the last swatch_
inputName?stringUsed as the HTML 'name' attribute for each swatch input_
onChange?(value: string) => voidCallback function that is called when the color changes_
rows?numberThe number of rows to display1
size'20' | '24' | '28' | '32' | '36' | '40'The width and height of the options'32'
valuestringThe currently selected color_