Skip to content
Nana UI

Tab Group

Organises content into a row of tabs and matching panels, with full keyboard support, a sliding active indicator, and four placements.

First Second Panel one. Panel two.
Terminal window
npm install @nana-tec/ui-components
import "@nana-tec/ui-components/tab-group";
<nana-tab-group style="width:100%">
<nana-tab slot="nav" panel="a">First</nana-tab>
<nana-tab slot="nav" panel="b">Second</nana-tab>
<nana-tab-panel name="a">Panel one.</nana-tab-panel>
<nana-tab-panel name="b">Panel two.</nana-tab-panel>
</nana-tab-group>

The variant attribute sets the tab styling — underline (default), pill, segmented, filled, ghost, or card.

First Second Pill panel one. Pill panel two. First Second Segmented panel one. Segmented panel two. First Second Filled panel one. Filled panel two. First Second Card panel one. Card panel two. First Second Ghost panel one. Ghost panel two.

Set placement to top (default), bottom, start, or end.

First Second Panel one. Panel two.
PropertyTypeDefaultDescription
placement'top' | 'bottom' | 'start' | 'end''top'Where the tabs sit relative to the panels.
activation'auto' | 'manual''auto'auto activates a tab as it’s focused; manual waits for Enter / Space / click.
variant'underline' | 'pill' | 'segmented' | 'filled' | 'ghost' | 'card''underline'Visual style applied to every tab in the group.
size'sm' | 'md' | 'lg''md'Size applied to every tab in the group.
noIndicatorbooleanfalseHide the sliding active indicator.
EventTypeDescription
nameCustomEvent
nana-tab-showCustomEventEmitted when a tab is shown (detail.name).
nana-tab-hideCustomEventEmitted when a tab is hidden (detail.name).
SlotDescription
navThe nana-tab elements.
(default)The nana-tab-panel elements.
VariableDefaultDescription
--nana-tab-group-indicator-colorColour of the active indicator.
--nana-tab-group-border-colorColour of the divider line.
--nana-tab-group-track-bgSegmented variant’s track fill. Defaults to a translucent tint of the text colour, so it reads on any surface; set an opaque colour to pin it.
PartDescription
baseThe host container
navThe tab navigation region
tablistThe scrollable tab list
indicatorThe active-tab sliding indicator
bodyThe panel container
  • Keyboard accessible
  • Screen-reader labels
  • Focus-visible states
  • ARIA roles and states
  • WCAG 2.2 AA contrast
Explore Tab Group interactively Every state, prop, and edge case — with live controls — in Storybook.
View in Storybook