# Tab (`.z-tab`)

> Underline and pill tablist styles with horizontal, bottom, and left/right layouts, plus a sliding active indicator driven by the Switcher controller.

- **Kind:** css
- **Category:** navigation

## CSS Variables

| Variable | Default | Scope | Affects | Description |
| --- | --- | --- | --- | --- |
| `--z-tab-active-border-color` | `var(--z-primary)` | `.z-tab > .z-active > a, .z-tab > .z-active > button` | `border-color` | Border color of the active tab's underline or side bar. |
| `--z-tab-active-border-color-o` | `100%` | `.z-tab > .z-active > a, .z-tab > .z-active > button` | `border-color` | Opacity applied to the active border color. |
| `--z-tab-alt-active-bg` | `var(--z-bg)` | `.z-tab-alt` | `background-color` | Background of the active pill, also used by the sliding indicator. |
| `--z-tab-alt-active-shadow` | `var(--z-global-shadow-small)` | `.z-tab-alt` | `box-shadow` | Shadow of the active pill and the sliding indicator. |
| `--z-tab-alt-padding` | `0.25rem` | `.z-tab-alt` | `padding` | Outer padding of the pill tablist track. |
| `--z-tab-alt-padding-inner` | `0 0.75rem` | `.z-tab-alt` | `padding` | Inner padding of each pill tab link. |
| `--z-tab-alt-radius` | `var(--z-global-radius)` | `.z-tab-alt` | `border-radius` | Corner radius of the pill tablist track. |
| `--z-tab-alt-radius-inner` | `var(--z-global-radius-small)` | `.z-tab-alt` | `border-radius` | Corner radius of the active pill and the sliding indicator. |
| `--z-tab-alt-transition` | `150ms cubic-bezier(0.16, 1, 0.3, 1)` | `.z-tab-alt` | `transition` | Transition timing for pill color and indicator movement. |
| `--z-tab-border-color` | `var(--z-border)` | `.z-tab` | `border-bottom`, `border-left` | Color of the tablist baseline (the bottom border, or the side border in left/right layouts). |
| `--z-tab-border-o` | `var(--z-border-o)` | `.z-tab` | `border-bottom`, `border-left` | Opacity applied to the baseline color. |
| `--z-tab-font-size` | `var(--z-global-font-size-small)` | `.z-tab` | `font-size` | Font size of tab links. |
| `--z-tab-indicator-color` | `var(--z-primary)` | `.z-tab` | `background-color` | Color of the sliding active indicator. |
| `--z-tab-indicator-h` | `0px` | `.z-tab[data-indicator-ready]::after` | `height`, `transform` | Height of the active tab, written by the switcher at runtime to size the indicator. |
| `--z-tab-indicator-o` | `100%` | `.z-tab` | `background-color` | Opacity applied to the indicator color. |
| `--z-tab-indicator-w` | `0px` | `.z-tab[data-indicator-ready]::after` | `transform`, `width` | Width of the active tab, written by the switcher at runtime to size the indicator. |
| `--z-tab-indicator-x` | `0px` | `.z-tab[data-indicator-ready]::after` | `transform` | Horizontal offset of the active tab, written by the switcher at runtime to position the indicator. |
| `--z-tab-indicator-y` | `0px` | `.z-tab[data-indicator-ready]::after` | `transform` | Vertical offset of the active tab, written by the switcher at runtime to position the indicator. |
| `--z-tab-item-padding` | `0.3125rem 0.625rem` | `.z-tab` | `padding` | Padding of each tab link. |
| `--z-tab-link-color` | `var(--z-muted-f)` | `.z-tab > * > a, .z-tab > * > button` | `color` | Text color of inactive tab links. |
| `--z-tab-link-color-o` | `100%` | `.z-tab > * > a, .z-tab > * > button` | `color` | Opacity applied to the inactive link color. |
| `--z-tab-link-gap` | `0.25em` | `.z-tab` | `column-gap` | Gap between a tab link's icon and its label. |
| `--z-tab-link-hover-color` | `var(--z-bg-f)` | `.z-tab > * > a, .z-tab > * > button` | `color` | Text color of tab links on hover. |
| `--z-tab-link-hover-color-o` | `100%` | `.z-tab > * > a, .z-tab > * > button` | `color` | Opacity applied to the hover link color. |
| `--z-tab-transition` | `150ms cubic-bezier(0.16, 1, 0.3, 1)` | `.z-tab` | `transition` | Transition timing for tab link color and indicator movement. |

## CSS Classes

| Class | Role | Applies to | Description |
| --- | --- | --- | --- |
| `.z-tab` | `root` | `.z-tab` | Underline tablist: a flex list of links or buttons sharing a baseline, with an active underline. Mark the active item `.z-active` and disabled items `.z-disabled`. |
| `.z-tab-alt` | `element` | `.z-tab` | Pill-style tablist variant: a rounded track whose active item is a raised pill. Use in place of `.z-tab`. |
| `.z-tab-bottom` | `modifier` | `.z-tab` | Moves the baseline and the active border to the top edge of the tablist. |
| `.z-tab-left` | `modifier` | `.z-tab` | Vertical tablist drawn on the left side, with the baseline and active bar on its right edge. |
| `.z-tab-right` | `modifier` | `.z-tab` | Vertical tablist drawn on the right side, with the baseline and active bar on its left edge. |

## Notes

- This component is styling only: switching behavior, keyboard navigation, and the sliding indicator come from the Switcher controller (`z-switcher`).
- The `--z-tab-indicator-x/y/w/h` variables and the `data-indicator-ready` / `data-indicator-animate` attributes are written by the switcher at runtime; theme them rather than setting them by hand.
- Without the switcher, mark the active item `.z-active` yourself; the static underline or pill still renders.

## Guides

- [Styling with cls and stl](https://next.0build.dev/docs/guides/styling.md)
- [Translating Components](https://next.0build.dev/docs/guides/i18n.md)
- [Icon Resolution](https://next.0build.dev/docs/guides/icons.md)
- [The data-source Convention](https://next.0build.dev/docs/guides/data-source.md)
- [Openers & Triggers](https://next.0build.dev/docs/guides/triggers.md)
- [Dialog Behavior](https://next.0build.dev/docs/guides/dialogs.md)
- [Utilities](https://next.0build.dev/docs/guides/utilities.md)
- [Runtime](https://next.0build.dev/docs/guides/runtime.md)

## Related

- [Switcher](https://next.0build.dev/docs/components/switcher.md)
