Tally UI

ProductVariantPicker

Displays variant option groups with selectable value chips

Import

import { ProductVariantPicker } from '@tallyui/components';

Usage

<ProductVariantPicker
  options={[
    { name: 'Size', values: ['S', 'M', 'L'] },
    { name: 'Color', values: ['Black', 'White'] },
  ]}
  selected={{ Size: 'M', Color: 'Black' }}
  onSelect={(selection) => setSelected(selection)}
/>

Renders each variant option as a labeled group of chip-style buttons. The active value in each group is highlighted. Selections are tracked as a key-value record.

Props

PropTypeDefaultDescription
optionsVariantOption[]requiredArray of option groups to display
selectedRecord<string, string>{}Currently selected values keyed by option name
onSelect(selection: Record<string, string>) => voidCallback with updated selection record
classNamestringOverride container styles

VariantOption

interface VariantOption {
  name: string;
  values: string[];
}

Live demo

On this page