Weftv0.4.0
GitHubFigma
Blade AI
Display & Navigation · Tabsstable

Tabs

Switches between related views in the same context, in filled, bordered or borderless styles, horizontal or vertical.

Preview

#preview

Switch variant, size, orientation, badge and state. Show code opens the React and CSS below.

Settled payments from the last 30 days.
filled · medium · horizontal · none · default
tabs-example.tsx
import { Tab, TabList, TabPanel, Tabs } from "@blade-ai/weft/components/tabs";

export function PaymentsTabs() {
  return (
    <Tabs defaultValue="all">
      <TabList accessibilityLabel="Payments">
        <Tab value="all">All</Tab>
        <Tab value="settled">Settled</Tab>
        <Tab value="failed">Failed</Tab>
      </TabList>
      <TabPanel value="all">All payments</TabPanel>
      <TabPanel value="settled">Settled payments</TabPanel>
    </Tabs>
  );
}

All states

#all-states

Every variant and size with default, hover, focus, selected and disabled tabs.

Tabs · 8 states · tab 2 is selected; hover, focus and disabled on tabs 3 to 5
Filled · medium
Filled · large
Bordered · medium
Bordered · large
Borderless · medium
Borderless · large
Vertical · filled
Vertical · bordered

Props

#props

Tabs, TabList, Tab and TabPanel. Compose them; Tab and TabPanel pair by value.

Tabs
Prop
Type
Default
Description
value
string
—
Controlled selected tab value. Use with onValueChange.
defaultValue
string
—
Initial selected value when uncontrolled.
onValueChange
(value: string) => void
—
Fires when the selection changes.
variant
"filled" | "bordered" | "borderless"
"filled"
filled: inset segmented control. bordered: rail with a primary indicator. borderless: indicator only.
size
"medium" | "large"
"medium"
Text 14 or 16px.
orientation
"horizontal" | "vertical"
"horizontal"
Vertical stacks the tabs and turns Up and Down into the arrow keys.
children
ReactNode
—
TabList and TabPanels. Required.
TabList
Prop
Type
Default
Description
accessibilityLabel
string
—
Accessible name of the tab list.
children
ReactNode
—
The Tabs. Required.
Tab
Prop
Type
Default
Description
value
string
—
Identifies the tab and its TabPanel. Required.
children
ReactNode
—
Tab label. Required.
badge
ReactNode
—
Optional count pill after the label.
isDisabled
boolean
false
Not focusable, 60% opacity.
data-state
"hover" | "focus"
—
Docs and testing hook: forces a visual state.
TabPanel
Prop
Type
Default
Description
value
string
—
Matches the Tab value that shows this panel. Required.
keepMounted
boolean
false
Keep the panel mounted (hidden) while another tab is selected.

Usage

#usage

Short rules for choosing and writing tabs.

Do
Use short labels of one or two words.
Keep every panel the same kind of content.
Use a count badge only for things people need to clear.
Choose bordered or borderless for page sections, filled inside a card.
Don't
Do not nest tabs inside tabs.
Do not use tabs for steps in order; use a Stepper.
Do not disable a tab without saying why nearby.
Do not mix horizontal and vertical tabs on one page.

Accessibility

#accessibility

WAI-ARIA tabs pattern with a roving tabindex. Arrow keys move focus and select.

Keyboard
Key
Action
Tab
Moves focus into the selected tab, then to its panel.
Right / Left
Selects the next or previous tab (horizontal).
Down / Up
Selects the next or previous tab (vertical).
Home / End
Selects the first or last enabled tab.
ARIA
Element
Role / attribute
When
TabList
role="tablist" · aria-orientation
Always. aria-label from accessibilityLabel.
Tab
role="tab" · aria-selected · aria-controls
Always. Only the selected tab has tabindex 0.
Tab
disabled
When isDisabled is set.
TabPanel
role="tabpanel" · aria-labelledby
Always. hidden when kept mounted but not selected.