Skip to content

Tabs

⋯

Tabs renders one Base UI root, list, trigger, and panel family. Horizontal and vertical compositions map to the corresponding Figma sets. The mobile view uses the Nesra Select for the same panel values.

Import Tabs from @nesra/ui/tabs or @nesra/ui. Compose one panel for each trigger value and include matching Select items for mobile.

import { Tabs } from "@nesra/ui/tabs";
export function ProjectSections() {
return (
<Tabs.Root defaultValue="overview">
<Tabs.List aria-label="Project sections">
<Tabs.Trigger value="overview">Overview</Tabs.Trigger>
<Tabs.Trigger value="activity">Activity</Tabs.Trigger>
</Tabs.List>
<Tabs.MobileSelect
aria-label="Project sections"
items={{ overview: "Overview", activity: "Activity" }}
/>
<Tabs.Panel value="overview">Project overview</Tabs.Panel>
<Tabs.Panel value="activity">Recent activity</Tabs.Panel>
</Tabs.Root>
);
}
Tabs.Root
├── Tabs.List
│ └── Tabs.Trigger (one per value)
├── Tabs.MobileSelect (matching options for mobile)
└── Tabs.Panel (one per value)
Edit your details here.

The six visual variants are shown with a disabled trigger.

brand

Overview panel

gray

Overview panel

line

Overview panel

border

Overview panel

minimal

Overview panel

pill

Overview panel

sm and md follow the trigger heights listed below. The mobile Select is 36px and 40px tall, respectively.

sm

Overview report

md

Overview report
Account settings

fullWidth divides available horizontal list width between triggers. It does not apply to vertical tabs.

Overview report

Use value and onValueChange when application state owns the active section.

Current section: overview

Overview report

The desktop list scrolls horizontally within its available width. Each label stays on one line.

Overview panel

Below 640px, Tabs.List is hidden and Tabs.MobileSelect appears. It renders the Nesra Select with a 36px height for sm and 40px for md. Its items must use the same string values as the triggers and panels. Use custom Select.Option children when an option must be disabled, and also provide the matching items map so the selected label renders. The Select needs an accessible name such as aria-label.

At 640px and wider, horizontal lists stay on one line and scroll horizontally if necessary. Labels remain intact. A vertical list retains its column layout. Badge content is a consumer slot. It does not depend on a public Badge component.

Desktop trigger heights follow the Figma visual type:

Variant Horizontal sm / md Vertical sm / md
brand, gray, minimal 36px / 44px 36px / 44px
line 32px / 36px 24px / 32px
border 36px / 44px 36px / 44px
pill 32px / 36px 32px / 36px

The border list adds padding and a border around those triggers. Its total height is 44px for sm and 56px for md. The pill list is 38px and 42px tall.

pill labels are Body/Small or Body/Medium Medium, with 14px and 16px side padding and a 4px icon gap. The other types use Semibold. A horizontal line trigger keeps its label at the top with 4px side padding, a 4px (sm) or 6px (md) icon gap, and 12px between triggers. A vertical line trigger has 12px (sm) or 14px (md) side padding and 8px between triggers.

Every trigger color comes from a semantic role, so the same classes render both modes when an ancestor sets .dark or data-theme="dark".

State Roles
Inactive text-support on alpha-transparent
Hover brand: action-secondary-hover and text-secondary. gray and pill: foundation-bg-gray. border: foundation-bg-neutral with shadow-xs. line: stroke-brand-primary underline
Selected text-body on the indicator: foundation-bg-brand-primary-50 (brand), foundation-bg-gray (gray), foundation-bg-neutral (border, minimal), stroke-brand-primary (line)
Selected pill text-on-brand on action-primary-default. The label is white in Light and gray-950 in Dark
Keyboard focus Two layers: a 2px foundation-bg-neutral gap and a 4px effects-focus-ring ring. brand, gray, border, and panels use shadow-nesra-focus-ring-offset outside the trigger. line, minimal, and pill draw an inset 2px effects-focus-ring ring with a 2px foundation-bg-neutral gap inside it, because their scrolling list leaves no room outside the trigger
Disabled text-disabled

The selected line label uses text-body. The Figma canvas binds text-brand-primary, which has the same value as the inactive text-support label. Figma draws every focus ring outside the trigger. Tabs are still unpublished in Figma.

Base UI associates each trigger and panel by their shared value, manages roving focus, and sets selected and hidden states. Tabs.Panel keeps inactive content mounted and hidden. Tabs.List uses manual activation by default. Arrow keys move focus. Enter or Space activates the focused tab. Set activateOnFocus on the list for automatic activation. Use an accessible list name, and keep the mobile Select items aligned with enabled triggers.

The desktop selection indicator moves to the active trigger unless the user prefers reduced motion. Panel content switches immediately.

Prop Type Default Effect
value string — Selects the tab in a controlled root.
defaultValue string First enabled Sets the initial uncontrolled selection.
orientation "horizontal" | "vertical" "horizontal" Sets list and keyboard direction.
variant "brand" | "gray" | "line" | "border" | "minimal" | "pill" "brand" Selects the visual type.
size "sm" | "md" "sm" Sets trigger and mobile selector size.
fullWidth boolean false Divides horizontal list width among tabs.

onValueChange receives the selected value and Base UI event details. An automatic fallback can send null when no enabled trigger remains. The mobile select then shows no selection. Tabs.Root also accepts Base UI Tabs root props, className, and a ref to the root element.

The API variant names map to Figma as follows:

API variant Horizontal Figma type Vertical Figma type
brand Button brand Button primary
gray Button gray Button gray
line Underline Line
border Button border Button border
minimal Button minimal Button minimal
pill Pill Pill
Prop Type Default Effect
activateOnFocus boolean false Activates a tab when arrow navigation focuses it.
loopFocus boolean true Wraps arrow navigation from the last tab to the first.

Tabs.List also accepts Base UI Tabs list props, className, and a ref to the list element.

Prop Type Default Effect
value string — Required. Associates the trigger with a panel.
disabled boolean false Skips keyboard focus and prevents selection.
badge ReactNode — Renders content after the label.

Tabs.Trigger also accepts Base UI Tabs tab props, className, and a ref to the button element.

The required string value associates the panel with a trigger. Inactive panels always remain mounted and hidden, so keepMounted is not configurable. Tabs.Panel accepts the other Base UI Tabs panel props, className, and a ref to the panel element.

Accepts Nesra Select props, className, and a ref to the trigger button. Its value follows the root’s selection, so value, defaultValue, and onValueChange cannot be set on the mobile selector. Provide an items map for standard options or custom Select.Option children for disabled options. Selecting an option activates the matching enabled trigger.

Visual values use the color roles, typography roles, layout scale, and shape tokens.