Navigation

Tab

Single selectable tab trigger inside a tabs composite that registers with the parent context and controls a matching tab-panel or caller-owned panel id.

import { Tab } from '@lostgradient/cinder';
navigationtabs
01

Overview

Individual tab trigger within a tab list for switching between labelled content panels.

Usage

Tab is a compose-only leaf of Tabs. The idiomatic API is Tabs.Trigger, reached through the parent namespace — see the tabs README for the composed snippet. The leaf is also a named export of @lostgradient/cinder.

02

When to use

Use when
  • Declaring one tab heading inside a tabs ancestor with a stable value identifier.
  • Pairing one-to-one with a tab-panel that shares the same value to wire aria-controls.
  • Pointing multiple tab triggers at a caller-owned panel with the controls prop.
Avoid when
  • Used outside a tabs ancestor — the component throws at construction.
  • Rendering a generic action button — use button instead.
03

Props

Props for tab
Name
Type
Default
Description
value required text Stable identifier used for tab selection; matches TabPanel in the default pattern.
id text Optional explicit id override; auto-generated otherwise for ARIA wiring.
controls text Optional non-empty aria-controls target for caller-owned panels. Empty or whitespace-only strings are treated as omitted. By default, Cinder points at the matching TabPanel id (${baseId}-panel-${value}).
label text The plain-text name this tab has in the narrow form's select. By default it is read from the tab's own text once it is on the page, without the count and trailing content; pass it when the label changes after the first render.
disabled boolean false Disables this single tab and removes it from keyboard activation.
children required snippet Tab label content.
trailing snippet Decorative content rendered inside an aria-hidden span (badges, kbd hints, counters). Do NOT use for interactive controls like close buttons — aria-hidden removes the content from the accessibility tree, making any interactive child unreachable by keyboard and invisible to screen readers. For a closeable tab, render a separate <button> immediately after the <Tab> in the DOM (as a sibling within the tab strip) and associate it with the tab via aria-label="Close [tab name]". The close button must live outside the <Tab> element entirely.
count number A count of things in this tab that want attention, drawn as a small pill after the label. Zero, a negative number and undefined show nothing, so a healthy tab carries no chip. The count is part of the tab's accessible name, so it never depends on colour.
countLabel text The words that follow the count in the pill's accessible name: "needs attention" gives "1 needs attention", so the tab reads "Workers 1 needs attention". Without it the pill reads as the bare number.
countTone 'neutral''success''warning''danger''info''accent' 'warning' Tone of the count pill. Defaults to 'warning', the amber of a count that needs attention.