Tabs
Keyboard-navigable views with three densities, two orientations, and manual or automatic activation.
Contract
| Axis | Values | Default |
|---|---|---|
uiSize | md, lg | md |
orientation | horizontal, vertical | horizontal |
| disabled tab | TRTabs.Tab disabled | false |
| activation | manual or activateOnFocus | manual |
| focus | looping or bounded | looping |
| state | controlled value, including null, or uncontrolled defaultValue | first enabled tab |
Install
pnpm add @tinyrack/uiScroll inside the code area to read long lines.
Styles
@import '@tinyrack/ui/components/tabs.css';Scroll inside the code area to read long lines.
Imports
import { TRTabs } from '@tinyrack/ui/components/tabs';Scroll inside the code area to read long lines.
Playground
Usage
Controlled manual activation permalink
Arrow keys move focus. Enter or Space selects the focused tab and updates the result.
Examples
Overflow with an indicator permalink
The narrow tab strip scrolls horizontally while the optional indicator follows the active tab.
Anatomy
Rootowns controlled or uncontrolled selection, orientation, anduiSize.Listis the labelled tablist and configures activation and focus looping.Tabidentifies a view byvalue; disabled tabs remain focusable but cannot activate.Indicatoris optional and follows the active tab, including in an overflow strip.Panelconnects accessible content to the tab with the samevalue.
API
| Part | Key props | Notes |
|---|---|---|
Root | value, defaultValue, onValueChange, orientation, uiSize | Use value={null} for no active tab. Without a value prop, the first enabled tab is selected. |
List | activateOnFocus, loopFocus | Manual activation and looping focus are the defaults. |
Tab | value, disabled, render | Arrow keys move focus; Enter or Space activates in manual mode. |
Indicator | renderBeforeHydration, render | Optional visual marker driven by Base UI geometry variables. |
Panel | value, keepMounted, hiddenUntilFound, render | Matches a tab value and preserves ARIA relationships. |
Base UI supplies roles, focus movement, selection, and hydration-safe state. Import tabs.css after your Tinyrack foundation styles. Customize with --tr-tabs-indicator-background, --tr-tabs-indicator-size, --tr-tabs-radius, --tr-tabs-tab-height, and --tr-tabs-panel-padding.