Toggle Group
A set of toggles — single or multiple selection.
01
Preview & playground
Edit the code — the preview updates live. Try changing props, text, or classes.
playground.tsx
render( <ToggleGroup type="single" defaultValue="center"> <ToggleGroupItem value="left" aria-label="Left">L</ToggleGroupItem> <ToggleGroupItem value="center" aria-label="Center">C</ToggleGroupItem> <ToggleGroupItem value="right" aria-label="Right">R</ToggleGroupItem> </ToggleGroup> )
02
Examples
Common variations — edit any of them live.
Multiple
playground.tsx
render( <ToggleGroup type="multiple" defaultValue={["bold"]}> <ToggleGroupItem value="bold">Bold</ToggleGroupItem> <ToggleGroupItem value="italic">Italic</ToggleGroupItem> <ToggleGroupItem value="underline">Underline</ToggleGroupItem> </ToggleGroup> )
03
Installation
Copy the source into your project with the registry CLI:
$pnpm dlx shadcn@latest add @stacklyui/toggle-groupOr install the package and import it:
$pnpm add @stacklyui/ui motion04
Usage
Import ToggleGroup from "@stacklyui/ui" and compose it as shown in the playground above. Every interactive primitive is built on Radix, so keyboard navigation, focus management, and ARIA are handled for you.