ClickorKeyboard shortcut Alt + L

Dragto resize

Nord Design System SearchDeveloperDeveloperGetting startedUsing Web ComponentsWebfontsCDNLocalizationCSS Framework Legacy ESLint PluginWorking with AIFAQDesignDesignGetting startedFoundationsThemesBrand assetsToolsComponentsComponentsAccordion New Aside New Autocomplete New AvatarBadgeBanner Updated ButtonButton GroupCalendar Updated CardCheckbox Updated Collapsible New Combobox New Command MenuDate Picker Updated Date Range Picker New DividerDrawerDropdownEmpty StateField New FieldsetFilter Bar New FooterHeaderIconInput Updated Item New Kbd New LayoutMessageMeter New ModalNavigationNotificationNumber Field New Otp Field New Outline New Pagination New Popout Updated ProgressProgress BarQrcodeRadio Updated Range Updated Scroll Area New Segmented ControlSelect Updated SkeletonSpinnerStackTabTableTagTextarea Updated Time Picker New ToastToggle Updated TooltipTop BarTruncate New Visually HiddenDesign TokensDesign TokensTailwind CSSTailwind CSSBlocksBlocksTemplatesTemplatesIconsIconsPlaygroundPlaygroundLatest UpdatesLatest UpdatesChangelogChangelogMigration guidesMigration guides
GitHub

Clickto expandKeyboard shortcut Alt + L

Tab

Open in Storybook

Toggle between related panels of content on the same page.

Loading...

Usage

Tabs let people switch between related panels of content in the same space. A Tab Group is the container; inside it, each Tab (with slot="tab") is paired with the Tab Panel that follows it.

Import the parts you need — each import registers its custom element:

import "@nordhealth/components/lib/TabGroup"
import "@nordhealth/components/lib/Tab"
import "@nordhealth/components/lib/TabPanel"

Then assemble a group of tabs and panels:

Composition

A Tab Group holds an alternating sequence of tabs and panels. Each tab is placed in the tab slot and is matched, in order, to the panel that follows it.

TabGroup
├── Tab        (slot="tab")
├── TabPanel
├── Tab        (slot="tab")
└── TabPanel
<nord-tab-group label="Workspace">
  <nord-tab slot="tab">Overview</nord-tab>
  <nord-tab-panel>…</nord-tab-panel>
  <nord-tab slot="tab">Projects</nord-tab>
  <nord-tab-panel>…</nord-tab-panel>
</nord-tab-group>

Tab Group

Tab Group is the container that coordinates the tabs and panels and manages keyboard focus. Give it a label for an accessible name; sticky keeps the tab strip visible while the panel scrolls, and padding controls the panel spacing.

Tab

Tab is a single tab. Place it in the tab slot and keep its label short. Use selected to mark the active tab. Tabs switch panels — they don't navigate to other pages; use Navigation or links for that.

Tab Panel

Tab Panel holds the content for the tab at the same position. It can contain both static and interactive content.

Examples

Basic

A labelled group with three tabs.

Sticky tabs with cards

Use sticky to keep the tab strip in view while the panel scrolls, and padding to space the panel content.

RTL

Tabs follow the document or container direction. Toggle the direction to see the layout mirror.

Accessibility

  • Give the Tab Group a label so the set of tabs has an accessible name.
  • The Tab Group implements the tabs keyboard pattern: arrow keys move between tabs and the matching panel is revealed, with aria-selected and the tab/panel relationship managed for you.
  • Keep Tab labels short and descriptive, and don't use tabs to navigate between pages — use Navigation or links instead.

Templates

See this component composed into complete application views:

Tabs TemplateA view that organises content across tabbed panels. Ready

API reference

Tab

The interactive tab button for use within the tab group component.

<nord-accordion></nord-accordion>

Props

PropertyAttribute Description TypeDefault
selectedselectedWhether the tab item is selectedbooleanfalse

Slots

Slot name Description
Default slotThe tab button content.

CSS Properties

CSS Custom Properties provide more fine grain control over component presentation. We advise utilizing existing properties on the component before using these.

PropertyDescriptionDefault
--n-tab-colorControls the text color of the tab, using our color tokens.var(--n-color-text-weak)
--n-tab-font-weightControls the font weight of the tab, using our font tokens.var(--n-font-weight)

Parts

This component is made up of the following parts.

Tab Group

Tab Group allows multiple panels to be contained within a single window, using tabs as a navigational element.

<nord-accordion-header></nord-accordion-header>

Props

PropertyAttribute Description TypeDefault
labellabelAdds an accessible label to the tab list container.string''
paddingpaddingControls the padding of the tab group component.'m' | 'l' | 'none' | undefined'm'
stickystickyWhether the tab list sticks to the top of the tab group as you scroll.booleanfalse

Slots

Slot name Description
Default slotThe element which contains the content to be revealed.
tabThe element which contains all tabs to reveal tabbed content.

CSS Properties

CSS Custom Properties provide more fine grain control over component presentation. We advise utilizing existing properties on the component before using these.

PropertyDescriptionDefault
--n-tab-group-paddingControls the padding around the tab group (including the tab list), using our spacing tokens.0

Tab Panel

The panel which contains content that can be revealed using a tab in the tab group component.

<nord-accordion-item></nord-accordion-item>

Slots

Slot name Description
Default slotThe tab panel content.
Design guidelinesFor designers

Usage

This section includes guidelines for designers and developers about the usage of this component in different contexts.

Do

  • Use the tab component within the tab group component.
  • Use the selected option to signify if the tab is selected.
  • Use text, icons and other non-interactive content within the tab.

Don’t

  • Don’t use tabs to navigate to other pages. Use navigation or links instead.
  • Don't use the tab component outside of the tab group component.
  • Don't add interactive elements, such as buttons and links, inside the tab component.

Content guidelines

When writing tab labels, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):

My tasks
My Tasks

Avoid unnecessary words and articles in tab labels, such as “the”, “an” or “a”:

Dashboard
The dashboard

Avoid ending tab labels in punctuation:

Patients
Patients.

Use as few words as possible to describe each tab label:

Payments
Payments in your clinic

Avoid all caps for tab labels:

Dashboard
DASHBOARD

Additional considerations

  • If the content contained within the tabs UI has significance or is important for the user to see, consider using a different form of presentation that doesn't obscure it.
  • If there is a particular section you wish to show out of order of the tabs UI itself consider using the selected option to select the tab but prevent the order of the tabs being affected.