---
title: "Button Group"
description: "Buttons, fields, and menu triggers that share their edges and read as one control, in a row or a column."
url: https://gelatinui.com/components/button-group
markdown_url: https://gelatinui.com/components/button-group.md
access: free
install: "npx shadcn@latest add @gelatin-ui/button-group"
registry_item: https://gelatinui.com/r/button-group.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Button Group

> Buttons, fields, and menu triggers that share their edges and read as one control, in a row or a column.

Page: https://gelatinui.com/components/button-group

## When to use it

Best for: Related controls that read as one: a split button, or a field with a button.

- Use it for 2 to 4 related controls.
- Use `ButtonGroupSeparator` between filled children.

## When not to use it

- For one value out of a set, use a [Segmented Control](https://gelatinui.com/components/segmented-control.md).

## Notes for agents

- Give it an `aria-label` or `aria-labelledby`.
- The size comes from the children.
- A group never wraps: move extra actions into a More menu on phones.

## Anatomy

```text
ButtonGroup
├─ ButtonGroupText (0..n)
└─ ButtonGroupSeparator (0..n)
```

## API reference

### ButtonGroup

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `orientation` | `"horizontal" \| "vertical"` | "horizontal" |  |
| `className` | `string` |  |  |

### ButtonGroupText

Also takes every prop of Base UI `UseRender`: https://base-ui.com/react/components/use-render

### ButtonGroupSeparator

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `variant` | `"dashed" \| "dotted" \| "double" \| "fade" \| "solid"` |  | The line pattern. Default: `solid`. |
| `tone` | `"default" \| "destructive" \| "info" \| "muted" \| "primary" \| "success" \| "warning"` |  | The color, from the shared tokens. Default: `default` (the border color). |
| `children` | `ReactNode` |  | Content in the middle of a horizontal line: "or", a date, an icon. The line then splits in two halves around it, and a text label is the name that screen readers hear. |

Also takes every prop of Base UI `Separator`: https://base-ui.com/react/components/separator

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| ButtonGroup | `button-group` | `aria-invalid`, `data-base-ui-focus-guard`, `data-disabled`, `data-loading`, `data-part`, `data-stage-focused` | `--button-group-icon-opacity`, `--button-group-ink-mix` | `hit-area` |
| ButtonGroupText | `button-group-text` |  |  |  |
| ButtonGroupSeparator | `button-group-separator` | `data-base-ui-focus-guard`, `data-variant` |  |  |

## Usage

Put the main action and its menu trigger in one group, with a `ButtonGroupSeparator` between them, for a split button.

The sample also uses `button`, `menu`, which this add does not write. One command adds them with this item:

```bash
npx shadcn@latest add @gelatin-ui/button-group @gelatin-ui/button @gelatin-ui/menu
```

```tsx title="send-button.tsx"
import { CaretDownIcon, PaperPlaneTiltIcon } from "@phosphor-icons/react/ssr";

import { Button } from "@/components/ui/button";
import { ButtonGroup, ButtonGroupSeparator } from "@/components/ui/button-group";
import { Menu, MenuContent, MenuItem, MenuTrigger } from "@/components/ui/menu";

export function SendButton() {
  return (
    <ButtonGroup aria-label="Send">
      <Button>
        <PaperPlaneTiltIcon data-icon="inline-start" />
        Send
      </Button>
      <ButtonGroupSeparator />
      <Menu>
        <MenuTrigger render={<Button size="icon" aria-label="Schedule send" />}>
          <CaretDownIcon />
        </MenuTrigger>
        <MenuContent align="end">
          <MenuItem>Tomorrow morning</MenuItem>
          <MenuItem>Monday morning</MenuItem>
        </MenuContent>
      </Menu>
    </ButtonGroup>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/button-group
```

It adds 6 registry items: 4 files, 592 lines, and the npm packages `@base-ui/react`, `clsx`, `tailwind-merge`, `tailwind-variants`.

## Built on

- [Separator](https://gelatinui.com/components/separator.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Animated Sparkles Icon](https://gelatinui.com/components/animated-sparkles-icon.md)
- [Animated Arrow Icon](https://gelatinui.com/components/animated-arrow-icon.md)
- [Separator](https://gelatinui.com/components/separator.md)
- [Button](https://gelatinui.com/components/button.md)
