Theme studio

Design a theme, preview it live, then export it. Saved in this browser.

Quick picks #10b981
Generated scale
50100200300400500600700800900
Some text is below AA

Tab

  • Stable
  • WCAG 2.2 evidence
  • RTL

One tab of a horizontal TabList. Built on React Aria Tab: role tab with aria-selected and aria-controls; inside the tab list the arrow keys move between tabs (mirrored in right-to-left locales), Home and End jump to the first and last tab, Tab moves into the panel, and disabled tabs are skipped (WCAG 2.1.1, 4.1.2). Selection follows focus by default (keyboardActivation="automatic" on Tabs); set keyboardActivation="manual" there when showing a panel is slow, so Enter or Space selects. With href the tab is a link and navigation is the router's job. The selected tab is shown by its underline, fill or box and a heavier label, not by colour alone (1.4.1). Keyboard focus shows the ring inside the tab, so the scrolling strip never clips it (2.4.7, 2.4.11). For side navigation in settings pages use VerticalTab. Consumer duties: short, translated labels that match the panels; a name for the TabList.

import { Tab } from "@nexera-ui/react";
Loading example…
5
examples
25
props
3
live controls
1
platform
10
WCAG criteria
3
blocks use it

Try every prop. Copy the code.

Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.

Loading…
variant
size
isDisabled
Generated code
import { Tab } from "@nexera-ui/react";

<Tab />

Examples 4

The same examples as Storybook, rendered live. Open Code to copy one.

Variants and sizes

Every Figma Variant and Size. Hover, focus and select the tabs to see the other states.

Loading example…

With icon and count

Figma Show icon and Show count: a 16 / 18 px icon before the label and a count pill after it.

Loading example…

Disabled

Figma Disabled state: the tab is skipped by the arrow keys and cannot be selected.

Loading example…

Right to left

Right-to-left: the order of the tabs and the arrow keys mirror; the count stays after the label.

Loading example…

Props 25

Press "Try it" on a card to load that prop into the playground.

25 props shown

id*Nexera
Key

Key of the tab. The TabPanel with the same id is the panel it shows; selectedKey and onSelectionChange use it.

Default –
label*Nexera
VisibleContent

Visible label: a 1 or 2 word noun that matches the panel's content ("Overview", "Documents"). It names the tab and stays on one line; a list with too many tabs scrolls horizontally.

Default –
iconNexera
ReactNode

Icon before the label: 16 px at sm, 18 px at md. Decorative: the label names the tab.

Default –
countNexera
string

Count after the label, for example "4". It is read as part of the tab's name ("Documents 4"); make sure the number makes sense in that sentence.

Default –
variantNexera
"underline" | "pill" | "enclosed"

Look. Defaults to the variant of the enclosing TabList, so set it there once.

Default "underline"
sizeNexera
"sm" | "md"

Height, padding and type: 32 px (Body/Small) or 40 px (Component/Label).

Default md
classNameNexera
string

Extra classes, merged last so they win over the defaults.

Default –
styleNexera
CSSProperties

Inline style.

Default –
isDisabledReact Aria
boolean

Whether the tab is disabled.

Default –
aria-labelReact Aria
string

Defines a string value that labels the current element.

Default –
aria-labelledbyReact Aria
string

Identifies the element (or elements) that labels the current element.

Default –
aria-describedbyReact Aria
string

Identifies the element (or elements) that describes the object.

Default –
hrefReact Aria
string

A URL to link to. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#href).

Default –
hrefLangReact Aria
string

Hints at the human language of the linked URL. See[MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#hreflang).

Default –
targetReact Aria
HTMLAttributeAnchorTarget

The target window for the link. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target).

Default –
relReact Aria
string

The relationship between the linked resource and the current page. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel).

Default –
downloadReact Aria
string | boolean

Causes the browser to download the linked URL. A string may be provided to suggest a file name. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download).

Default –
pingReact Aria
string

A space-separated list of URLs to ping when the link is followed. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#ping).

Default –
referrerPolicyReact Aria
"" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"

How much of the referrer to send when following the link. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#referrerpolicy).

Default –
routerOptionsReact Aria
never

Options for the configured client side router.

Default –
onPressReact Aria
(e: PressEvent) => void

Handler that is called when the press is released over the target.

Default –
onPressStartReact Aria
(e: PressEvent) => void

Handler that is called when a press interaction starts.

Default –
onPressEndReact Aria
(e: PressEvent) => void

Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target.

Default –
onPressChangeReact Aria
(isPressed: boolean) => void

Handler that is called when the press state changes.

Default –
onPressUpReact Aria
(e: PressEvent) => void

Handler that is called when a press is released over the target, regardless of whether it started on the target or not.

Default –

* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.

Accessible by default.

Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.

WCAG 2.2 evidence

6 direct · 4 supporting
  • 1.1.1Non-text ContentLevel A · tested directly
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.3.2Meaningful SequenceLevel A · tested directly
  • 1.4.1Use of ColorLevel A · supporting test
  • 1.4.4Resize TextLevel AA · supporting test
  • 2.1.1KeyboardLevel A · tested directly
  • 2.4.7Focus VisibleLevel AA · tested directly
  • 2.4.11Focus Not Obscured (Minimum)Level AA · supporting test
  • 2.5.8Target Size (Minimum)Level AA · supporting test
  • 4.1.2Name, Role, ValueLevel A · tested directly

Fits any width.

Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.

0 px · drag the corner

Styling hooks

Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.

  • data-disabled
  • data-focus-visible
  • data-hovered
  • data-selected
Usage
<Tab className="data-disabled:opacity-90 shadow-sm" />

Used in blocks

Related components