VariantSelector
A flexible variant selector that supports both single and multiple selection modes. Renders card-style items that can display images or colours. Single mode is a Base UI RadioGroup and multiple mode a Base UI ToggleGroup, so either way the set is one tab stop and the arrow keys move between items.
Usage
Best practices
Fill it with
VariantSelectorItemchildren - they read selection from context;value/defaultValuematches each item'svalue.modeis a discriminated prop:"single"renders arole="radiogroup"and givesonValueChangeastring,"multiple"renders a<fieldset>of pressed-state toggles and astring[]- keepvalue/defaultValuetypes matching the mode.defaultValueis uncontrolled: the selector tracks later picks itself. PassvaluewithonValueChangeto control it.Use
VariantSelectorfor image/colour swatch pickers; for a labelled icon-over-text option grid useIconCard, and for plain radio/checkbox lists useRadioGroup/Checkbox.