Tabs

Switches between related panels. Text labels in one row; active tab has a 1px underline.

Issue

204 module

A poster you can install. Hairline on the active tab only.

Use it for

  • Two to six views of the same object that share one place on the page.
  • orientation="vertical" on TabList for a stacked rail.

Not for

  • Navigation between pages; use NavigationMenu with real links.
  • Sequential steps; use Stepper.

Three ways in. They share one source, so the pixels match whichever you pick.

1. Import the package

npm install @noorddev/vlak-react

// once, next to your app's root
import "@noorddev/vlak-react/css";

import { Tab, TabList, TabPanel, Tabs } from "@noorddev/vlak-react";

Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/tabs.

2. Vendor the source

npx @noorddev/vlak-cli add tabs

The StyleX leaf lands in components/vlak/, for your own compiler to own. See StyleX.

3. Through shadcn

npx shadcn add https://vlak.dev/r/tabs.json

The same registry item, installed by shadcn's CLI.

CSS only

<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />

No React. Link vlak.css and use the markup and classes below.

import { Tab, TabList, TabPanel, Tabs } from "@noorddev/vlak-react";

<Tabs defaultValue="overview">
  <TabList aria-label="Project">
    <Tab value="overview">Overview</Tab>
    <Tab value="activity">Activity</Tab>
    <Tab value="settings">Settings</Tab>
  </TabList>
  <TabPanel value="overview">…</TabPanel>
  <TabPanel value="activity">…</TabPanel>
  <TabPanel value="settings">…</TabPanel>
</Tabs>

Tab

PropTypeDefaultDescription
valuerequiredstring

Also accepts ButtonHTMLAttributes<HTMLButtonElement>.

TabList

Roving tabs: arrows step, Home/End jump, and selection follows focus.

PropTypeDefaultDescription
orientation"horizontal" | "vertical""horizontal"Stacked tabs answer Up/Down instead of Left/Right.

Also accepts HTMLAttributes<HTMLDivElement>.

TabPanel

PropTypeDefaultDescription
valuerequiredstring

Also accepts HTMLAttributes<HTMLDivElement>.

Tabs

PropTypeDefaultDescription
valuestring
defaultValuestring
onValueChange(value: string) => void

Also accepts Omit<HTMLAttributes<HTMLDivElement>, "onChange">.

KeysDoes
TabMoves focus to the selected tab, then into the panel
Arrow left, Arrow rightMoves to the previous or next tab and selects it (wraps)
Arrow up, Arrow downThe same when orientation is vertical
Home, EndFirst or last tab
<div class="rs-tabs"><span class="rs-tab rs-tab-active">Overview</span><span class="rs-tab">Activity</span><span class="rs-tab">Settings</span></div>
.rs-tabs.rs-tabs-vertical.rs-tab.rs-tab-active