Variant picker
A fieldset of Swatch radios. The legend shows the
selected option’s label beside it, and a small script keeps that in step as
the choice changes. Options with a color render as colour dots; the rest
render as labelled pills.
Options
Section titled “Options”name: radio group name, also the prefix for option ids (required)legend: the option’s name (required)options: list of{ label, value, color, disabled }(required)selected: value of the checked option (default the first option)
<VariantPicker name="colour" legend="Colour" options={[ { label: "Sand", value: "sand", color: "#d8c7a8" }, { label: "Navy", value: "navy", color: "#28344d" }, ]}/>