Skip to content
SENVENLI UI

Tabs

Switches between views of the same content; SegmentedControl switches a small set of options inline.
Views of one record
import {
  Tabs,
  TabList,
  Tab,
  TabPanel,
  SegmentedControl,
} from "@senvenli/react/navigation";

Examples

Composed from parts

`TabList`, `Tab` and `TabPanel` as children: an icon in a label, panels built from your own components.

Variants and sizes

`underline` (default), `pills` and `outline`; `size` small, medium or large.

Vertical

`orientation="vertical"`: the tabs in a column beside the panel; arrows go up and down.

Controlled

The app owns the selected tab, for example to keep it in the URL.

SegmentedControl

A small set of options switched inline, with no panels of its own.

Guidelines

When to use it

  • Two to seven views of one thing: Overview, Activity, Settings.

Use something else when

Accessibility

Keyboard

KeysWhat happens
Arrow keysMoves between tabs.

Built in

  • Tabs and panels are linked; counts are announced.

You provide

  • Short nouns for tab labels.
  • With children: one TabPanel per Tab, matched by the same id, and an aria-label on TabList when no heading names it.

API reference

Tabs

items
readonly TabItem[]

Two to six tabs as data. Leave it out and compose TabList, Tab and TabPanel as children instead, for a tab with an icon, a panel built elsewhere, or tabs rendered from your own components.

children
React.ReactNode

With no items: a TabList of Tabs followed by one TabPanel per tab, matched by id.

selectedKey
Key
defaultSelectedKey
Key
onSelectionChange
(key: Key) => void
aria-label
string

Names the tab list when no heading above it does (with items; on TabList otherwise).

variant
TabsVariant

underline (default): a line under the selected tab; pills: a filled tab; outline: a framed tab.

orientation
"horizontal" | "vertical"

horizontal (default), or vertical: the tabs in a column beside the panels (settings pages).

size
ComponentSize

small, medium (default) or large; the provider default otherwise.

motion
ComponentMotion

auto (follow the device), reduce or none, for this component; the provider's setting otherwise.

TabList

childrenRequired
React.ReactNode

Tab elements.

aria-label
string

Names the tab list when no heading above it does.

aria-labelledby
string

Tab

idRequired
Key

Matches the TabPanel with the same id.

childrenRequired
React.ReactNode

The label: a noun, one or two words, optionally with an Icon before it.

count
number

A count after the label (a Badge); hidden at 0.

isDisabled
boolean

TabPanel

idRequired
Key

Matches the Tab with the same id.

childrenRequired
React.ReactNode

SegmentedControl

labelRequired
string

Names the group for assistive tech ("Period"); it is not shown.

itemsRequired
readonly SegmentedControlItem[]

Two to five short options ("Day", "Week", "Month").

value
Key
defaultValue
Key
onChange
(value: Key) => void
isDisabled
boolean