SwatchSelector
Row of selectable color/image swatches with controlled single selection,
built on Base UI ToggleGroup: the row is one tab stop and the arrow keys move
between swatches.
Shares the selected value, onValueChange, and size with its
{@link SwatchSelectorItem} children through context.
Usage
Best practices
Pair
SwatchSelectorwithSwatchSelectorItemchildren - it sharesvalue/onValueChange/sizethrough context, so items need no individual wiring.Prefer
SwatchGroupwhen the row is a single-choice form control needing radio roles and form submission;SwatchSelectoris a row of pressed-state toggle buttons.Pressing the selected swatch again keeps it selected and does not call
onValueChange.Selection is controlled - pass
valueand update it fromonValueChange; there is no internal fallback state to fall back on.
Props
Swatch
SwatchMore
SwatchSelector
SwatchSelectorItem
Composition
Used by