Tally UI

ProductVariantPicker

ProductVariantPicker displays labeled variant option groups with selectable chips and returns selected values keyed by option name.

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. Values listed in dimmed are drawn faded but stay pressable, as in WCPOS v2, so the cashier can still see and pick every value.

Props

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

VariantOption

interface VariantOption {
  name: string;
  values: string[];
  dimmed?: string[]; // values no variant takes with the other picks; drawn faded, still pressable
}

Live demo