Bloom Choice
Web (React)
A row of mono chips where the chosen one swells with a springy pop.
Bloom Choice is a single-choice radio group of mono uppercase chips. Picking one makes it swell softly into the primary colour while its neighbours yield. Arrow keys, Home and End all work.
Installation
CLI
npx @modus-ui/cli add bloom-choiceManual
- Copy the code from the component tab.
- Create a file at
components/ui/bloom-choice.tsx. - Paste the code.
Usage
tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| items | any | DEFAULT_ITEMS | Choices, as strings or item objects. |
| value | any | - | Controlled selected value. |
| defaultValue | any | - | Initial value when uncontrolled. |
| onChange | any | - | Called with the new value and index. |
| chipColor | string | "hsl(var(--muted))" | Chip background colour. |
| activeColor | string | "hsl(var(--primary))" | Selected chip colour. |
| textColor | string | "hsl(var(--muted-foreground))" | Chip text colour. |
| activeTextColor | string | "hsl(var(--primary-foreground))" | Selected chip text colour. |
| size | string | "md" | Chip size: "sm", "md" or "lg". |
| gap | number | 8 | Space between chips in pixels. |
| radius | number | 18 | Chip corner radius in pixels. |
| swell | number | 0.2 | How much the chosen chip grows. |
| barge | number | 6 | How far neighbours are pushed aside, in pixels. |
| shrink | number | 0.05 | How much neighbours shrink. |
| jelly | number | 1 | Strength of the wobble. |
| bounce | number | 0.25 | Spring bounce. |
| stagger | number | 22 | Delay between neighbour reactions in milliseconds. |
| stiffness | number | 580 | Spring stiffness. |
| disabled | boolean | false | Disables selection. |
| ariaLabel | string | "Options" | Accessible label for the group. |
Comments