Toggle group: Spacing
spacing puts a gap between items on the spacing scale. Outline items with a gap keep their own borders and fills.
This adds the example as components/examples/toggle-group/spacing.tsx, together with the Toggle group component and the HextaUI theme tokens it needs.
pnpm dlx shadcn@latest add https://hextaui.com/r/toggle-group-spacing.jsonTo add only the component, follow the Toggle group installation.
Props in this example
The Toggle group props this example sets, from the API reference.
| Prop | Type | Default |
|---|---|---|
defaultValue | string[] | – |
multiple | boolean | false |
variantSets every item's variant. | "default" | "outline" | "default" |
sizeSets every item's size. | "default" | "sm" | "lg" | "default" |
spacingGap between items on the spacing scale. 0 joins outline items. | 0 | 0.5 | 1 | 1.5 | 2 | 2.5 | 3 | 4 | 5 | 6 | 8 | 0 |
| Prop | Type | Default |
|---|---|---|
valueIdentifies the item in the group's value. | string | – |
Every prop is in the Toggle group API reference.
See them all, with keyboard support and accessibility notes, on the Toggle group page.
- MotionThe easing curves, durations and reduced-motion check every component animates with, plus hooks for size morphs and sliding highlights.
- ToggleA button that stays on or off, with a fill that settles in when pressed, a clear hover-to-on step and icons that can fill with the state.
- ButtonButtons in every variant and size, with a built-in loading, success and error flow that skips the spinner for fast requests.
- Button groupButtons joined into one control, with shared seams, separators, text addons, nesting and vertical stacks.