Variant Picker
InputMITSingle-select product-option swatches (grind, size, color) with selected + out-of-stock states.
bun add @otfdashkit/ui
Preview
Variant PickerInput
Loading Storybook preview…
Code
@otfdashkit/uiimport { useState } from 'react'
import { VariantPicker } from '@otfdashkit/ui'
export function Example() {
const [grind, setGrind] = useState('whole')
return (
<div className="w-[360px]">
<VariantPicker
label="Grind"
value={grind}
onValueChange={setGrind}
options={[
{ value: 'whole', label: 'Whole bean' },
{ value: 'espresso', label: 'Espresso' },
{ value: 'filter', label: 'Filter' },
{ value: 'french', label: 'French press' },
]}
/>
</div>
)
}
Free with the SDK. This component ships in @otfdashkit/ui under the MIT license.
Props
Props declared in the VariantPicker source. Inherited HTML attributes are not listed.
| Prop | Type | Default | Description |
|---|---|---|---|
| optionsrequired | VariantOption[] | ||
| defaultValue | string | (readonly string[] & string) | Uncontrolled initial value. | |
| label | string | Group label, e.g. "Grind" or "Size". | |
| onValueChange | (value: string) => void | ||
| value | string | Controlled selected value. |