# Button Group

> Groups buttons that share size and variant.

Registry name: `button-group`. HTML docs: https://ui.anuragroy.dev/component/button-group.

## Install

```bash
npx shadcn@latest add https://ui.anuragroy.dev/r/button-group.json
```

If the website is down: `npx shadcn@latest add https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/button-group.json`.

Registry JSON: https://ui.anuragroy.dev/r/button-group.json (GitHub: https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/button-group.json).

## Import

Import paths follow the consumer `components.json` aliases. After a default install:

```tsx
import { ButtonGroup } from "@/components/ui/button-group"
```

## Usage

```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

### ButtonGroup

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `orientation` | "horizontal" \| "vertical" | "horizontal" |  |
| `variant` | Button variant | — | Default variant for child buttons. |
| `size` | Button size | — | Default size for child buttons. |

## Notes

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

## See also

- [HTML page](https://ui.anuragroy.dev/component/button-group): Preview and the same docs in the site chrome.
- [Registry item](https://ui.anuragroy.dev/r/button-group.json): Source files and dependencies.
- [Catalog](https://ui.anuragroy.dev/component): All components.
- [llms.txt](https://ui.anuragroy.dev/llms.txt): Agent index for this library.
