Skip to content
navius

Tabs

A set of layered sections of content, known as tab panels, that are displayed one at a time.

Features

  • Can be controlled (@bind-Value) or uncontrolled (DefaultValue).
  • Full keyboard navigation with a roving tabindex.
  • Supports horizontal and vertical orientation.
  • Automatic (focus activates) or manual (Enter/Space activates) activation modes.
  • Direction-aware: flips horizontal arrow keys in RTL.

Installation

Reference the Navius.Primitives package for the headless primitive, or vendor a styled version with the CLI: navius add copies the styled zits/ui component plus the brain files it depends on.

Anatomy

Import the parts and assemble them.

API Reference

Contains all the parts of a tab group. Renders a div.

Prop Type Default
Value string? -
ValueChanged EventCallback<string?> -
DefaultValue string? -
Orientation string "horizontal"
ActivationMode string "automatic"
Dir string? -
ChildContent RenderFragment? -
Data attribute Values
[data-orientation] "horizontal" | "vertical"

Contains the triggers that are aligned along the edge of the active content. Renders a div.

Prop Type Default
Loop bool true
ChildContent RenderFragment? -
Data attribute Values
[data-orientation] "horizontal" | "vertical"

The button that activates its associated panel. Renders a button.

Prop Type Default
Value string ""
Disabled bool false
ChildContent RenderFragment? -
Data attribute Values
[data-active] Present on the active tab.
[data-orientation] "horizontal" | "vertical"
[data-disabled] Present when disabled

Contains the content associated with each tab. Renders a div.

Prop Type Default
Value string ""
KeepMounted bool false
ChildContent RenderFragment? -
Data attribute Values
[data-hidden] Present when the panel is not the active one.
[data-orientation] "horizontal" | "vertical"

Accessibility

Implements the roles, states, and keyboard map of the tabs WAI-ARIA APG pattern. Behavior is covered by the browser test suite and an axe-core WCAG gate in CI.

Key Description
Tab Moves focus to the active trigger. From a trigger, moves focus out of the list to the active panel.
ArrowDown In vertical orientation, moves focus to the next trigger.
ArrowRight In horizontal orientation, moves focus to the next trigger.
ArrowUp In vertical orientation, moves focus to the previous trigger.
ArrowLeft In horizontal orientation, moves focus to the previous trigger.
Home Moves focus to the first trigger.
End Moves focus to the last trigger.
Enter Activates the focused trigger (in manual activation mode).
Space Activates the focused trigger (in manual activation mode).