Angular playground

Nova v3.37.0

Preview

Angular

Tabs

nv-tabs

Switch related content with application-owned panels and accessible keyboard navigation.

Parts

Live demo

Use tabs to switch between related views within a page. The tab strip keeps the available views visible, and an underline identifies the selected view. Your application supplies the content panels and keeps them aligned with the selected value.

Anatomy

A tab strip with seven callouts: 1 marks a tab item, 2 a leading icon, 3 a label, 4 a notification count, 5 a trailing icon, 6 the selected tab's underline, and 7 the full-width separator.

The parts of tabs, following the design reference.
  1. Tab item (nv-tabitem) represents one view in the group.
  2. Leading icon optionally reinforces the view's meaning.
  3. Label is the visible name of the view.
  4. Notification optionally shows a count of new items.
  5. Trailing icon is optional supporting content.
  6. Active underline marks the tab selected by the container's value.
  7. Separator is the optional line beneath the full container, enabled with showSeparator. The active underline remains visible without it.

Composing tabs and panels

Place nv-tabitem children directly in nv-tabs. Give each item a unique value, a visible label, and a panelId. The group owns selection; an item has no public selected property.

Design settingComponent API
ItemsDefault slot of nv-tabs, containing nv-tabitem children
Active viewvalue on the container matches the item's value
Unavailable viewdisabled on the item
Full-width baselineshowSeparator on the container; off by default
Optional item contentleadingIcon, trailingIcon and notification

Render each panel with role="tabpanel", an ID matching its tab's panelId, and aria-labelledby pointing to that tab's ID. Update panel visibility from the group's valueChanged event. A programmatic change to an available value does not emit that event, so update the panels from the same application state. The checked examples show the complete relationship in each framework.

The first enabled tab becomes selected when no available value is supplied. If the selected tab is removed or disabled, the group selects the next enabled tab, falling back to a previous one, and reports the changed value.

States and themes

Tabs have default, hover, selected and disabled appearances in Spark and Ocean, in light and dark mode. Selection changes the label, icons and underline together. A disabled item stays visible and cannot be activated. Counts appear from 1; omitting notification or setting it to 0 hides them.

default · selected · disabled
with separator
without separator

Layout and accessibility

Tabs are horizontal. Each label stays on one line; whole items wrap in source order when the container narrows. There is no scroll strip, overflow menu or vertical variant. Keep labels short and use icons and counts when they add meaning.

Name the tablist with aria-label or aria-labelledby. The group has one Tab stop. Left and Right move focus between enabled tabs; Home and End reach the first and last enabled tab. Enter or Space selects the focused tab. Disabled tabs are skipped. Make the selected panel's content reachable next in the keyboard sequence.

Decorative icons are hidden from assistive technology. Translate notificationLabel to describe the count without replacing the tab's name; {count} is replaced with the number. Keep the selected underline and the keyboard focus indicator visible.

DoGive each view a short, distinct label.
Don'tAvoid turning tab labels into sentences.

Use Navbar for destinations on different pages and Toggle button group for a setting or filter.

Sources