Skip to content
Nana UI

Tab

A single tab within a nana-tab-group. Place tabs in the group’s nav slot and link each to a panel via the panel attribute. The host element is the focusable tab (role="tab"), so assistive tech and the group’s roving-tabindex navigation operate on a single element.

Overview Activity Overview panel. Activity panel.
Terminal window
npm install @nana-tec/ui-components
import "@nana-tec/ui-components/tab";
<nana-tab-group style="width:100%">
<nana-tab slot="nav" panel="a">Tab</nana-tab>
<nana-tab-panel name="a">Panel.</nana-tab-panel>
</nana-tab-group>

Add a count badge to a tab.

Inbox Drafts Inbox panel. Drafts panel.

Add closable to show a close button on a tab.

Overview Settings Overview panel. Settings panel.
PropertyTypeDefaultDescription
panelstring''The name of the panel this tab controls (matches a panel’s name).
activebooleanfalseWhether the tab is the active/selected one (managed by the group).
disabledbooleanfalseDisable the tab.
closablebooleanfalseShow a close button.
countstring | number | undefinedOptional count shown as a small badge after the label.
variant'underline' | 'pill' | 'segmented' | 'filled' | 'ghost' | 'card''underline'Visual style. Usually set automatically by the parent nana-tab-group.
size'sm' | 'md' | 'lg''md'Tab size. Usually set automatically by the parent nana-tab-group.
tabIdnana-tab-${++tabIdCounter}Stable id used for the tab/panel aria relationship.
EventTypeDescription
nana-tab-closeCustomEventEmitted when the tab is closed via the button or Delete / Backspace (detail.panel).
SlotDescription
(default)The tab’s label.
prefixContent before the label, typically an icon.
suffixContent after the label, e.g. a count badge.
VariableDefaultDescription
--nana-tab-hover-bgHover fill for the pill, filled and ghost variants. Defaults to a translucent tint of the text colour, so it reads on any surface; set an opaque colour to pin it.
--nana-tab-active-bgFill of the active thumb in the segmented variant.
PartDescription
baseThe tab’s inner container
countThe built-in count badge
close-buttonThe close button
Explore Tab interactively Every state, prop, and edge case — with live controls — in Storybook.
View in Storybook