EXEPERTAI LAB

Research alpha

Time Machine
EXEPERTAI LAB
GALLERY / COLLECTION
← Browse Astryx gallery
TabList·component·@astryxdesign/core

Tab

Individual tab item that renders as a button or an anchor link, with selected-state styling and optional icons.

Open in Playground @astryxdesign/core/TabList

Showcases and examples

2 documented examples

Tab

Tab is an individual tab item within a TabList, supporting labels, icons, selected icons, and end content slots.

Preview loads on approachPreview loads on approach
Exact source · tab-showcase
// Copyright (c) Meta Platforms, Inc. and affiliates.

'use client';

import {useState} from 'react';
import {TabList, Tab} from '@astryxdesign/core/TabList';
import {Badge} from '@astryxdesign/core/Badge';

export default function TabShowcase() {
  const [value, setValue] = useState('inbox');
  return (
    <TabList value={value} onChange={setValue}>
      <Tab
        value="inbox"
        label="Inbox"
        endContent={<Badge label="3" variant="info" />}
      />
    </TabList>
  );
}

Usage

Individual tab item that renders as a button or an anchor link, with selected-state styling and optional icons.

Typed props

PropType and behavior
valuestring · required
Unique value for this tab, matched against TabListContext.value.
labelstring · required
Accessible label for this tab. Used as visible text by default, or as aria-label when isLabelHidden is true.
isLabelHiddenboolean · default false
Whether the label is visually hidden. When true, only the icon and endContent are displayed, and label is used as aria-label for accessibility.
hrefstring
URL to navigate to; when provided, the tab renders as an anchor element. Ignored in a TabList given an explicit role="tablist".
panelIdstring
Id of the panel this tab controls, wired up as aria-controls where the TabList speaks the tabs pattern. Put the same id on the panel element. No effect under the navigation pattern, and a development warning says so.
asLinkComponentType
Custom component to render instead of <a> for link tabs. Overrides the LinkProvider default. Only applies when href is provided.
iconReactNode
Icon element shown when the tab is not selected.
Slot: Icon
selectedIconReactNode
Icon element shown when the tab is selected; falls back to icon if not provided.
Slot: Icon
endContentReactNode
Content rendered after the label, such as a badge count or status dot.
Slot: Icon, Badge
xstyleStyleXStyles
StyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value: not an inline style object like style={{}}.