For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /dolan/tabs.md.

Tabs

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

Installation

npx @blotch/dolan add tabs
import {
  UiTabs,
  UiTabsContent,
  UiTabsList,
  UiTabsTrigger,
} from '../components/ui/tabs';
Tip

Tabs depends on segmented-control, which draws the segmented variant and builds on Glass and Icon. dolan add installs them automatically.

Usage

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:

<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 for what each platform draws.
  • The phone ticks when the selection changes, with LynxHaptics, 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 for separate sections of an app. Keep it to about five tabs on a phone.

Without a signal

<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

InputTypeDefaultDescription
valuestring''The active tab's value. Supports [(value)].
classstring''Extra Tailwind classes for the container.
OutputTypeDescription
changedstringEmits the value of the tab the user tapped.
valueChangestringEmits the new value, for [(value)].

UiTabsTrigger

InputTypeDefaultDescription
valuestringRequiredThe panel this trigger shows.
classstring''Extra Tailwind classes for the trigger.

No outputs.

UiTabsContent

InputTypeDefaultDescription
valuestringRequiredThe trigger that shows this panel.
classstring''Extra Tailwind classes for the panel.

No outputs.

UiTabsList

InputTypeDefaultDescription
variant'default' | 'segmented''default'The tab row, or the segmented control.
classstring''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.
  • Accordion: stacked sections instead of tabs
  • Toggle: a segmented control without panels
  • Tab Bar: tabs along the bottom of the screen that switch routed screens