Tabs

A React component in Beamline's Navigation category, in the free sample.

Switches between panels of one object; one indicator slides to the active tab, counts sit beside labels, and the tabs a row has no room for fold into More.

Use it for

  • Switching between panels of the same object: Overview, Activity, Settings; Positions and Orders.

Not for

Anatomy

  • Tabs
  • TabsList (indicator, More menu for the tabs with no room)
  • TabsTrigger (icon, label, count)
  • TabsContent
  • TabsNav (the same row as navigation: nav, indicator, More)
  • TabsNavItem (link or button, aria-current=page)

Variants

  • variant: underline, pill

States

  • active
  • inactive
  • hover
  • pressed
  • disabled
  • folded row: the underline row folds the last tabs it has no room for into More (the chosen tab always stays); they come back as the room grows
  • overflowing row: a pill row, or one tab wider than the room, scrolls sideways

Keyboard

  • ← → move and activate
  • Home / End jump
  • Folded row: → from the last tab moves on to More and ← comes back (mirrored in RTL); ↓ or Enter opens it and Enter chooses a tab, which comes back into the row while the indicator travels to it
  • Tab moves into the panel
  • Direction follows explicit props or the managed scope and resolves the surrounding static direction; forwarded refs keep internal direction measurement attached. refreshAppearance updates static scope changes without remounting controls.
  • TabsNav: Tab moves between items; Enter (links) or Enter and Space (buttons) follow one

Motion

The indicator (line or pill) travels as matter (ui/lib/contour.ts), shaped by the look's mechanics (--m-morph-*): in soft its corner facing the new tab answers first, its leading edge rounds out a few pixels, the middle draws a slight neck and the corners round toward a capsule while it is stretched, then it gathers into its plain box. Nothing overshoots (critically damped, ~0.26 s, the far corner a little later). Metal, blueprint and mono stay rigid (it slides and stretches with straight edges); pop stretches most; glass is a little heavier; ink thins like a brush. The choice itself is made at once (state, colour, focus); only the decorative indicator (line or pill) settles. At rest: no clip and no frames. A press is acknowledged at once (press scale). The new panel fades in and arrives from the side its tab is on (from the end when the choice moved along the row, from the start when it went back), over the page duration; reduced motion keeps only the fade. A fold is semantic zoom: as the room narrows the last tabs go into More and the indicator follows its tab to its new place. Reduced motion: it jumps.

Props

PropTypeDefaultDescription
value / defaultValue / onValueChangestring—value: On TabsNav / TabsNavItem: Controlled value of the active tab; omit to use defaultValue. defaultValue: On TabsNav: Initial value of the active tab when uncontrolled. Defaults to no active tab. onValueChange: On TabsNav: Reports value of the active tab after an edit; no callback by default.
TabsList variant"underline" | "pill""underline"variant: On TabsList: Legacy appearance setting; omitted by default. Deprecated: Use appearance instead.
TabsTrigger icon / countReactNode / number—icon: On TabsTrigger: Icon element shown beside the label. Defaults to no leading icon. count: On TabsTrigger: A number after the label: open orders, unread items.
TabsList.classNames / TabsTrigger.classNamestyped part classes—TabsList.classNames: On TabsList: Classes for the named visual parts; no part overrides by default. TabsTrigger.classNames: On TabsTrigger: Classes for the named visual parts; no part overrides by default.
TabsNav / TabsNavItemvalue, defaultValue, onValueChange, variant / value, href?, icon?, count?—Tabs that switch pages or routes rather than panels: a nav with the same look and travelling indicator, the current item aria-current=page. Tab moves between items, Enter follows one.
styleCSSProperties—Inline styles on the documented visual root; no overrides by default.
refHTMLDivElement (Tabs/TabsList), HTMLButtonElement (TabsTrigger)—Receives the documented native target or imperative handle; omitted by default.
appearanceTabsVariant—On TabsList / TabsNav: Underline or pill treatment for the active tab; defaults to underline.
TabsList.variantTabsVariant—On TabsList: Legacy appearance setting; omitted by default. Deprecated: Use appearance instead.
TabsList.classNamesPartial<Record<"root" | "indicator", string>>—On TabsList: Classes for the named visual parts; no part overrides by default.
TabsTrigger.iconReactNode—On TabsTrigger: Icon element shown beside the label. Defaults to no leading icon.
TabsTrigger.countnumber—On TabsTrigger: A number after the label: open orders, unread items.
TabsTrigger.classNamesPartial<Record<"root" | "count", string>>—On TabsTrigger: Classes for the named visual parts; no part overrides by default.
TabsNav.valuestring—On TabsNav: Controlled value of the active tab; omit to use defaultValue.
TabsNav.defaultValuestring—On TabsNav: Initial value of the active tab when uncontrolled. Defaults to no active tab.
TabsNav.onValueChange((value: string) => void)—On TabsNav: Reports value of the active tab after an edit; no callback by default.
TabsNav.variantTabsVariant—On TabsNav: Legacy appearance setting; omitted by default. Deprecated: Use appearance instead.
TabsNav.classNamesPartial<Record<"root" | "list" | "indicator", string>>—On TabsNav: Classes for the named visual parts; no part overrides by default.
TabsNavItem.value (required)string—On TabsNavItem: Controlled value of the active tab. Required.
TabsNavItem.hrefstring—On TabsNavItem: A link instead of a button, for route changes the browser should know about.
TabsNavItem.iconReactNode—On TabsNavItem: Icon element shown beside the label. Defaults to no leading icon.
TabsNavItem.countnumber—On TabsNavItem: Count displayed beside the tab label; omitted by default to show no count.
TabsNavItem.classNamesPartial<Record<"root" | "count", string>>—On TabsNavItem: Classes for the named visual parts; no part overrides by default.
panels"scroll" | "switch"—switch (default): one panel shows at a time. scroll: the panels lie side by side on a track that scrolls sideways; choosing a tab scrolls to its panel, and a swipe or sideways wheel chooses the tab whose panel it settles on. The TabsContent panels must be direct children of Tabs; they stay mounted.

Built from

Used in

Dependencies

@radix-ui/react-direction, @radix-ui/react-tabs

Import

import { Tabs, TabsList, TabsTrigger, TabsNav, TabsNavItem, TabsContent } from "@beamline/tabs";

Get it

Tabs is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Tabs is included in the free MIT sample. Get Beamline · Connect your agent

More in Navigation

  • Sidebar: The app's main navigation: sections, items with counts and one level of sub-pages, an icon rail with tooltips (⌘B, the trigger or the edge), and a sheet…
  • Tree view: Nested folders and records with the full tree keyboard model (arrows, Home/End, *, type to jump), depth guides, counts and animated opening.
  • Stepper: Where someone is in a multi-step flow: done steps carry a check, the current one a ring, and the line between marks fills as steps complete.
  • Table of contents: The sections of a long page beside it, with the one being read marked as you scroll: the marker travels down the rail between sections, the rail fills…
  • Navigation menu: A site or docs header whose sections open into one panel that resizes and slides between them; NavigationMenuCard is the standard link row.
  • Menu bar: A desktop-style File / Edit / View bar for editor-like apps; each menu takes the same rows as the dropdown menu, and pointing moves between open menus.
  • Pagination: Moves through pages of a known length: first, last and the current page's neighbours, with an optional “41–60 of 468”. It answers to its own room…
  • User menu: The account menu behind the avatar: who is signed in, status, theme, account pages and sign out with progress; a bottom sheet on phones.
  • Breadcrumb: Where a page sits and the way back up; it shows as many levels as its room holds and folds the ones nearest the top into a menu.

Guides: Build your own React UI style with Beamline

Part of Beamline UI: polished, editable React components and complete screens for custom applications. Build your own style from any look; tokens, fonts, radii, motion; not only colours.