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

# Tabs

Panels that share one space, switched by a row of tab buttons.


## Installation

```bash
npx @blotch/dolan add tabs
```

```typescript
import {
  UiTabs,
  UiTabsContent,
  UiTabsList,
  UiTabsTrigger,
} from '../components/ui/tabs';
```

:::tip
Tabs depends on `segmented-control`, which draws the segmented variant and builds on [Glass](/dolan/glass.md) and [Icon](/dolan/icon.md). `dolan add` installs them automatically.
:::

## Usage

```typescript title="src/app/app.ts"
import { Component, signal } from '@angular/core';
import { LYNX_ELEMENTS } from '@blotch/angular-lynx';
import {
  UiTabs,
  UiTabsContent,
  UiTabsList,
  UiTabsTrigger,
} from '../components/ui/tabs';

@Component({
  selector: 'app-root',
  imports: [LYNX_ELEMENTS, UiTabs, UiTabsList, UiTabsTrigger, UiTabsContent],
  template: `
    <ui-tabs [(value)]="tab">
      <ui-tabs-list>
        <ui-tabs-trigger value="account">Account</ui-tabs-trigger>
        <ui-tabs-trigger value="password">Password</ui-tabs-trigger>
      </ui-tabs-list>
      <ui-tabs-content value="account">
        <text class="text-sm text-foreground">Change your name and email.</text>
      </ui-tabs-content>
      <ui-tabs-content value="password">
        <text class="text-sm text-foreground">Change your password.</text>
      </ui-tabs-content>
    </ui-tabs>
  `,
})
export class App {
  protected readonly tab = signal('account');
}
```

- A trigger and a panel belong together when their `value` matches.
- Set a starting `value`. With the default `''`, no tab is active and every panel is hidden.
- Triggers wrap their content in `<text>`, so pass plain text.
- A label stays on one line, and one too long for its tab ends with "…".
- The tab bar hugs its triggers instead of filling the width, up to the width it's given.

### Segmented control

Switch between closely related views with the platform's segmented control:

```angular-html
<ui-tabs [(value)]="view">
  <ui-tabs-list variant="segmented">
    <ui-tabs-trigger value="photos">Photos</ui-tabs-trigger>
    <ui-tabs-trigger value="albums">Albums</ui-tabs-trigger>
    <ui-tabs-trigger value="people">People</ui-tabs-trigger>
  </ui-tabs-list>
  <ui-tabs-content value="photos">…</ui-tabs-content>
  <ui-tabs-content value="albums">…</ui-tabs-content>
  <ui-tabs-content value="people">…</ui-tabs-content>
</ui-tabs>
```

- **A thumb slides to the tab you tap,** or follows your finger when you drag it, and the panel switches where you let go.
- **On iOS 26 the thumb lifts into Liquid Glass** while it moves, as UIKit's segmented control does. Before iOS 26 it's the control of iOS 13 to 18, and on Android Material 3 Expressive's connected button group. See [Toggle](/dolan/toggle.md#segmented-control) for what each platform draws.
- **The phone ticks when the selection changes,** with [`LynxHaptics`](/api/angular-lynx/device/haptics.md), on a tap and as a dragged thumb crosses onto each tab.
- **It fills the width it's given,** and the tabs share it equally. As in UIKit, a label gets nearly its whole tab, and one that still doesn't fit ends with "…". `class="flex-[2]"` on a trigger makes it wider.

Apple's guidelines suggest a segmented control for views that belong together, and a [tab bar](/dolan/tab-bar.md) for separate sections of an app. Keep it to about five tabs on a phone.

### Without a signal

```angular-html
<ui-tabs value="account" (changed)="onTab($event)">…</ui-tabs>
```

A plain `value` sets the starting tab. `changed` emits the value of each tab the user taps.

### Panels keep their state

Every panel stays rendered, and inactive ones are hidden rather than removed. So components inside a panel keep their state when the user switches away and back.

When the active tab changes, the new panel slides in from the side of the tab that was tapped.

## API

### UiTabs

| Input   | Type     | Default | Description                                   |
| ------- | -------- | ------- | --------------------------------------------- |
| `value` | `string` | `''`    | The active tab's value. Supports `[(value)]`. |
| `class` | `string` | `''`    | Extra Tailwind classes for the container.     |

| Output        | Type     | Description                                 |
| ------------- | -------- | ------------------------------------------- |
| `changed`     | `string` | Emits the value of the tab the user tapped. |
| `valueChange` | `string` | Emits the new value, for `[(value)]`.       |

### UiTabsTrigger

| Input   | Type     | Default  | Description                             |
| ------- | -------- | -------- | --------------------------------------- |
| `value` | `string` | Required | The panel this trigger shows.           |
| `class` | `string` | `''`     | Extra Tailwind classes for the trigger. |

No outputs.

### UiTabsContent

| Input   | Type     | Default  | Description                           |
| ------- | -------- | -------- | ------------------------------------- |
| `value` | `string` | Required | The trigger that shows this panel.    |
| `class` | `string` | `''`     | Extra Tailwind classes for the panel. |

No outputs.

### UiTabsList

| Input     | Type                       | Default     | Description                                                  |
| --------- | -------------------------- | ----------- | ------------------------------------------------------------ |
| `variant` | `'default' \| 'segmented'` | `'default'` | The tab row, or the [segmented control](#segmented-control). |
| `class`   | `string`                   | `''`        | Extra Tailwind classes for the row.                          |

No outputs. The file also exports the `TabsListVariant` type.

## Accessibility

- **The list is a tab bar** to VoiceOver, which reads each trigger as a tab and the selected one as selected.
- **Reduce Motion:** panels appear without sliding in, and the segmented control's thumb jumps instead of sliding or lifting into glass.

## Related

- [Accordion](/dolan/accordion.md): stacked sections instead of tabs
- [Toggle](/dolan/toggle.md): a segmented control without panels
- [Tab Bar](/dolan/tab-bar.md): tabs along the bottom of the screen that switch routed screens
