Skip to content

Swatch

Each swatch is a native radio, so arrow keys move between options and the choice submits with a form. Group swatches that share a name in a fieldset, or use Variant picker, which does that for you. A colour swatch hides its label visually and shows it as a tooltip on hover.

Colour
  • id, name, value, label: required
  • color: any CSS colour; when set the swatch defaults to a colour dot
  • variant: swatch (default when color is set) or outline (default otherwise)
  • size: compact, regular (default)
  • checked, disabled and other input attributes pass to the radio. A disabled outline swatch is faded and struck through
<Swatch id="colour-sand" name="colour" value="sand" label="Sand" color="#d8c7a8" checked />
<Swatch id="size-m" name="size" value="m" label="M" />
variant="outline", with a disabled option
Size
size="compact"