Toggle Group
A set of two-state buttons that can be toggled on or off. Built on Toggle. Connected items use logical start/end radius and borders for RTL.
Basic
Multi-select toolbar with type="multiple".
Installation
CLI
Also needs
npx @sonojs/ui@latest add toggleComposition
structure
Usage
toggle-group.tsx
Direction
dir comes from useDirection. With spacing={0}, first/last items use rounded-s / rounded-e (not left/right).
direction.tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| type | "single" · "multiple" | — | Single selection or multi-select. |
| variant | "default" · "outline" | "default" | Passed through to items via context. |
| size | "sm" · "default" · "lg" | "default" | Item height scale. |
| spacing | number | 0 | Gap between items. `0` connects them with shared borders. |
| orientation | "horizontal" · "vertical" | "horizontal" | Layout axis of the group. |
| dir | "ltr" · "rtl" | inherited | Writing direction for corners and keyboard nav. |