---
title: Button Group
description: A container that groups related buttons together with consistent styling.
---

<ComponentPreview name="button-group-demo">

```tsx file=<rootDir>/apps/docs/src/registry/examples/button-group-demo.tsx

```

</ComponentPreview>

## Installation

<ComponentInstallation>

<Step>

<StepItem>Copy and paste the following code into your project:</StepItem>

  <ComponentSourceTabs>

    ```tsx title="components/ui/button-group" file=<rootDir>/apps/docs/src/registry/ui/button-group.tsx

    ```

    ```tsx title="components/ui/button-group" file=<rootDir>/apps/unocss-playground/src/registry/ui/button-group.tsx

    ```

  </ComponentSourceTabs>

</Step>

</ComponentInstallation>

## Usage

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

```tsx
<ButtonGroup>
  <Button />
  <Button />
</ButtonGroup>
```
