Forms
Navigation & layout
Data display & feedback
Date & time
Browse components
← All components
Toggle Button Group
Group of mutually exclusive (or multiple) toggle buttons.
Install
npx shadcn@latest add https://ui.anuragroy.dev/r/toggle-button-group.jsonPreview
Loading preview…
Installation
Add the component from this site. The shadcn CLI fetches the registry JSON over HTTPS — no named registry submission required.
Terminal
npx shadcn@latest add https://ui.anuragroy.dev/r/toggle-button-group.jsonGitHub fallback if the website is down:
Terminal
npx shadcn@latest add https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/toggle-button-group.jsonUsage
Import paths follow your components.json aliases. After install, the default path is @/components/ui/toggle-button-group.
Import
import { ToggleButtonGroup } from "@/components/ui/toggle-button-group"example.tsx
import { ToggleButton } from "@/components/ui/toggle-button"import { ToggleButtonGroup } from "@/components/ui/toggle-button-group"export function Example() { return ( <ToggleButtonGroup defaultValue={["left"]}> <ToggleButton value="left">Left</ToggleButton> <ToggleButton value="center">Center</ToggleButton> <ToggleButton value="right">Right</ToggleButton> </ToggleButtonGroup> )}API Reference
ToggleButtonGroup
Base UI ToggleGroup root. Child `ToggleButton`s need a `value`.
| Prop | Type | Default |
|---|---|---|
| defaultValue | string[] | — |
| value | string[] | — |
- defaultValue — Uncontrolled selected values.
- value — Controlled selected values.