Skip to content

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.json

Preview

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.json

GitHub 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.json

Usage

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

PropTypeDefault
orientation"horizontal" | "vertical""horizontal"
variantButton variant—
sizeButton size—
  • variant — Default variant for child buttons.
  • size — Default size for child buttons.

Notes

  • `useButtonGroup()` reads the shared context from inside a child button.