Forms
Navigation & layout
Data display & feedback
Date & time
Browse components
← All components
Button Group
Groups buttons that share size and variant.
Install
npx shadcn@latest add https://ui.anuragroy.dev/r/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/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/button-group.jsonUsage
Import paths follow your components.json aliases. After install, the default path is @/components/ui/button-group.
Import
import { ButtonGroup } from "@/components/ui/button-group"example.tsx
import { Button } from "@/components/ui/button"import { ButtonGroup } from "@/components/ui/button-group"export function Example() { return ( <ButtonGroup variant="secondary"> <Button>One</Button> <Button>Two</Button> <Button>Three</Button> </ButtonGroup> )}API Reference
ButtonGroup
| Prop | Type | Default |
|---|---|---|
| orientation | "horizontal" | "vertical" | "horizontal" |
| variant | Button variant | — |
| size | Button size | — |
- variant — Default variant for child buttons.
- size — Default size for child buttons.
Notes
- `useButtonGroup()` reads the shared context from inside a child button.