# Button Group

Outline buttons joined into one row: shared edges, outer corners only. Each stays its own tab stop, and the focused or hovered one rises above its neighbours so its edge shows whole. For one choice among several use Segmented Control; for arrow-key movement use Toolbar.

- Beta: ready to use; its API can still change in a minor release.
- Category: Actions

```tsx
import { ButtonGroup, ButtonGroupText } from "@leap-crm/design-system";
```

## Best practices

- Do: Use `outline` buttons inside it. Their borders draw the shared edges, and only the outer corners are rounded.
- Do: Give the group an `aria-label` that names the set, like Export or Month, so a screen reader announces what the buttons belong to.
- Do: Use `ButtonGroupText` for a label cell inside the row, like the month between the previous and next buttons.
- Don't: Use it for one choice among several, like a list or board view. Use `SegmentedControl` or `ViewSwitch`, which show which option is selected.
- Don't: Use it when the row should be one tab stop with arrow keys between its buttons. Every button in a group is its own tab stop; use `Toolbar` instead.

## Keyboard

| Keys | What they do |
| --- | --- |
| Tab | Moves from one button to the next: each is its own tab stop. |
| Enter, Space | Presses the focused button. |

## Related

- [Segmented Control](./segmented-control.md)
- [Toolbar](./toolbar.md)
- [Action Row](./action-row.md)
- [Button](./button.md)

## Examples

What the examples import:

```tsx
import { ChevronLeft, ChevronRight, Download } from "lucide-react";
import { Button, ButtonGroup, ButtonGroupText, IconButton } from "@leap-crm/design-system";
```

### Buttons

Tab through: each button shows the blue edge and halo above its neighbours.

```tsx
<div className="flex flex-col items-start gap-4">
  <ButtonGroup aria-label="Export">
    <Button intent="outline" size="sm" icon={<Download />}>
      Export
    </Button>
    <Button intent="outline" size="sm">
      CSV
    </Button>
    <Button intent="outline" size="sm">
      PDF
    </Button>
  </ButtonGroup>
  <ButtonGroup aria-label="Month">
    <IconButton
      intent="outline"
      size="sm"
      icon={<ChevronLeft />}
      aria-label="Previous month"
    />
    <ButtonGroupText>November 2026</ButtonGroupText>
    <IconButton
      intent="outline"
      size="sm"
      icon={<ChevronRight />}
      aria-label="Next month"
    />
  </ButtonGroup>
</div>
```

## Props

### ButtonGroup

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `aria-label` | `string` |  | Names the group, like "Page view". |
| `children` | `ReactNode` |  | What it shows inside. |
| `className` | `string` |  | Classes added to the root element, merged with its own. Tokens only. |

### ButtonGroupText

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` (required) | `ReactNode` |  | What it shows inside. |
| `className` | `string` |  | Classes added to the root element, merged with its own. Tokens only. |
