Skip to content
TrademarkTrademark
Docs
Form Controls

ColorButton

Updated: November 17, 2026
View on GitHub
Soon
Not released yet. The published package does not include this yet, so it will not install today.

ColorButton is a small secondary button that shows a swatch and the colour's hex, and opens the browser's colour picker. Before a colour is picked it shows its label beside a swatch of every hue. Use it for a custom colour beside a row of preset swatches, where a full ColorInput field would be too heavy.

Preview and commit

  • onValueChange fires on every drag while the picker is open. Use it for a live preview.
  • onValueCommit fires once, when the picker closes on a new colour. Save, send or record an undo step here, so a drag does not produce dozens of saves.

The button shows the dragged colour while the picker is open, even before the host commits it.

Accessibility

The button is the control. Its accessible name is the label followed by the colour (Own colour: #00B5BA). The native colour field it opens is out of the Tab order and hidden from assistive technology. To link a note under the button, such as a contrast warning, pass its id as aria-describedby.

Props

Type
Default
value
The colour, controlled, as #rrggbb. Leave it out and the button keeps its own.
string—
defaultValue
The starting colour when `value` is left out.
string—
labelrequired
The text before a colour is picked, and the button's accessible name.
string—
onValueChange
Receives each colour while the picker is open, for a live preview.
(value: string) => void—
onValueCommit
Receives the colour once, when the picker closes on a new one.
(value: string) => void—
size
sxllmxs
s
variant
primarysecondarytertiary
secondary
disabled
boolean—
showValue
Show the hex once there is a colour (the default), or keep the label.
booleantrue
id
string—
aria-describedby
string—
className
string—
style
React.CSSProperties—
Edit this page on GitHub