> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# Button Group

A row or column of connected buttons that reads as one toolbar, where each button runs its own action. With a glass variant, the buttons share one Liquid Glass background, as iOS groups toolbar items.


## Installation

```bash
npx @blotch/dolan add button-group
```

```typescript
import {
  UiButtonGroup,
  UiButtonGroupItem,
} from '../components/ui/button-group';
```

This also adds [Glass](/dolan/glass.md), which draws the glass variants, and [Icon](/dolan/icon.md). Button Group imports `class-variance-authority` (see [Installation](/dolan/index.md#installation)).

## Usage

```typescript title="src/app/app.ts"
import { Component } from '@angular/core';
import {
  UiButtonGroup,
  UiButtonGroupItem,
} from '../components/ui/button-group';

@Component({
  selector: 'app-root',
  imports: [UiButtonGroup, UiButtonGroupItem],
  template: `
    <ui-button-group>
      <ui-button-group-item (pressed)="copy()">Copy</ui-button-group-item>
      <ui-button-group-item (pressed)="paste()">Paste</ui-button-group-item>
    </ui-button-group>
  `,
})
export class App {
  protected copy(): void {}
  protected paste(): void {}
}
```

- The group sets the look of every item. Each item emits its own `pressed`.
- Nothing stays selected. For buttons that stay on, use a toggle group from [Toggle](/dolan/toggle.md).
- The group hugs its items. Add `class="w-full"` to stretch it.

### Variants

```angular-html
<ui-button-group variant="default">…</ui-button-group>
<ui-button-group variant="outline">…</ui-button-group>
```

`default` fills the items with the secondary color. `outline` uses the background color inside a border.

### Glass

One glass background for a group of actions that floats over your content, like a toolbar on iOS 26:

```angular-html
<ui-button-group variant="glass" size="icon">
  <ui-button-group-item accessibility-label="Undo" (pressed)="undo()">
    <ui-icon name="undo-2" />
  </ui-button-group-item>
  <ui-button-group-item accessibility-label="Redo" (pressed)="redo()">
    <ui-icon name="redo-2" />
  </ui-button-group-item>
  <ui-button-group-item accessibility-label="Share" (pressed)="share()">
    <ui-icon name="share-2" />
  </ui-button-group-item>
</ui-button-group>
```

- **`glass`** is regular glass. **`glass-clear`** is clear glass for over photos and video, on a dark dimming layer so its white icons stay legible.
- **The group is one glass shape** and its items are plain. iOS draws grouped toolbar items this way. Glass circles merged in a [glass group](/dolan/glass.md#groups) would join with pinched waists instead, and glass shouldn't sit on glass.
- **A pressed item lights up** in corners concentric with the group's. On iOS 26 the glass also swells under the finger.
- **A row is a capsule.** A column is too when its items are icons, and otherwise has round corners.

What each platform draws:

| Platform                                          | Glass variants                                                                         |
| ------------------------------------------------- | -------------------------------------------------------------------------------------- |
| iOS 26 and later                                  | One Liquid Glass shape, drawn by iOS                                                   |
| iOS 15 to 25                                      | One shape on the thin blur material                                                    |
| Android                                           | Material 3's connected button group: tonal buttons 2px apart, with round outer corners |
| Android, with [`provideGlass()`](/dolan/glass.md) | One glass shape without the refraction                                                 |
| [Web preview](/guide/glossary.md#web-preview)     | One Liquid Glass shape, drawn with WebGL                                               |

### Sizes

```angular-html
<ui-button-group size="sm">…</ui-button-group>
<ui-button-group size="default">…</ui-button-group>
<ui-button-group size="lg">…</ui-button-group>
<ui-button-group size="icon">…</ui-button-group>
```

`icon` makes square items for one [`<ui-icon>`](/dolan/icon.md) each. Give each an `accessibility-label`, which a screen reader says instead. In the other sizes, an icon sits before the label.

### Vertical

```angular-html
<ui-button-group orientation="vertical" variant="outline">
  <ui-button-group-item (pressed)="openProfile()">Profile</ui-button-group-item>
  <ui-button-group-item (pressed)="openSettings()">
    Settings
  </ui-button-group-item>
</ui-button-group>
```

### Disabled

```angular-html
<ui-button-group disabled>…</ui-button-group>

<ui-button-group>
  <ui-button-group-item (pressed)="undo()">Undo</ui-button-group-item>
  <ui-button-group-item disabled>Redo</ui-button-group-item>
</ui-button-group>
```

Disable the whole group, or one item. A disabled item dims and doesn't emit `pressed`.

## API

### UiButtonGroup

| Input         | Type                                                 | Default        | Description                              |
| ------------- | ---------------------------------------------------- | -------------- | ---------------------------------------- |
| `orientation` | `'horizontal' \| 'vertical'`                         | `'horizontal'` | Lays the items out in a row or a column. |
| `variant`     | `'default' \| 'outline' \| 'glass' \| 'glass-clear'` | `'default'`    | Visual style of every item.              |
| `size`        | `'default' \| 'sm' \| 'lg' \| 'icon'`                | `'default'`    | Height and padding of every item.        |
| `disabled`    | `boolean`                                            | `false`        | Disables every item.                     |
| `class`       | `string`                                             | `''`           | Extra Tailwind classes for the group.    |

No outputs.

### UiButtonGroupItem

| Input                 | Type      | Default | Description                                              |
| --------------------- | --------- | ------- | -------------------------------------------------------- |
| `disabled`            | `boolean` | `false` | Disables this item only.                                 |
| `accessibility-label` | `string`  | —       | What a screen reader says. Needed for an icon-only item. |
| `class`               | `string`  | `''`    | Extra Tailwind classes for the item.                     |

| Output    | Type   | Description                                         |
| --------- | ------ | --------------------------------------------------- |
| `pressed` | `void` | Emits on tap, unless the item or group is disabled. |

The file also exports `buttonGroupItemVariants` and the `ButtonGroupVariant`, `SolidButtonGroupVariant`, `GlassButtonGroupVariant`, `ButtonGroupLook`, `ButtonGroupSize` and `ButtonGroupOrientation` types.

## Accessibility

- **A screen reader reads each item's label as a button,** or its `accessibility-label`.
- **Reduce Motion:** solid items dim while pressed instead of shrinking. Glass and Material items only light up, which isn't motion, and the web preview's glass stops swelling.
- **Reduce Transparency and Increase Contrast:** the glass follows them as [Glass](/dolan/glass.md#accessibility) does. Under Increase Contrast, Android's Material items get an outline.

## Related

- [Button](/dolan/button.md): a single button, with glass variants too
- [Glass](/dolan/glass.md): the Liquid Glass the glass variants draw
- [Toggle](/dolan/toggle.md): buttons that stay pressed
