Tabs
Two unrelated components carry the tab name. CTabs builds a real role="tablist" strip over a panel area from an array of items and a bound value. CTab builds a single closable chip that renames itself on double-click, and it is not an ARIA tab at all: the strip, the roles and the keyboard belong to whatever lays a row of them out.
This page explains the model. Usage shows how to apply each of them, and Reference lists the props, events, slots and the DOM they render.
Why one name covers two components
A tab set is a view switch over a fixed set, and a tab chip is one entry in a working list. A plugin store showing details beside a changelog is two panels behind two buttons, so it uses CTabs. A Replay session strip grows while somebody works, each entry is renamed and closed on its own, and no entry owns a panel, so it uses CTab.
What CTabs settles
A call site supplies items and a bound value. The strip geometry, the indicator, the roving focus and the arrow key handling come from the component and its preset, and a tab's width comes from its label.
The caller writes no roles and no identifiers. CTabs DOM and ARIA lists what the component renders, and Measurements gives the sizes.
When a tab set is the right choice
Is the set fixed, small, and is each entry a whole panel of content? Then this is the component: two to five entries, each named in a word or two, decided when the feature was written. Nothing behind a hidden tab should need watching while another is open.
When something else fits better
| Instead of | Reach for |
|---|---|
| Switching one value rather than a panel of content | Segmented |
| A set that grows while somebody works | CTab, laid out by the call site |
| A set that outgrows the row it sits in | Select |
| Panels that all have to stay on screen at once | A splitter, or a stacked layout |
Selection is said three ways at once
An active tab moves its label to fg-secondary, changes its 1 pixel bottom border to line-secondary, and carries a 4 pixel bar of fill-secondary under it inside the page-coloured band.
The bar on its own could not carry the selected state in the light theme, where it measures 2.14 against the page surface. Beside an underline and a colour change it can afford that, as Contrast shows and Colour explains.
The indicator prop removes the bar and leaves the other two.
What CTab is for instead
A chip holds two flush buttons inside a 1 pixel border: the label button, which grows to fill the chip, and a close button. The label takes an optional icon and an optional prefix slot, which Replay fills with status avatars and a tag.
Selecting a chip changes the colour of its border and nothing else, so the selected state rests on line-selected alone.
Double-click swaps the label for a focused text field. It has no keyboard equivalent, so each call site also offers Rename in a context menu, as accessibility requires.
What the pattern costs
A CTabs mounts each of its panels on the first render and hides the inactive ones, so a panel that is expensive to build pays for itself even when nobody opens it. Guarding a panel shows the fix.
A row wider than its container scrolls with no scrollbar and no buttons, so it gives no sign of it. The tab list also cannot be named, because a forwarded aria-label lands on the outer container rather than on the tab list.
A class on CTabs never reaches the DOM, and CTab forwards everything. That split is the component contract, and Usage shows what to write on each.
One size and one colour scheme
Neither component takes a size, severity, variant or disabled prop, as Vocabulary records. What varies on a CTabs is which tab is active. What varies on a CTab is whether it is selected, whether it is being renamed, and whether an icon or a prefix is present.