Park UI

Tabs

A navigation component for switching between different content panels.

Know React? Check out Solid!

Installation

Usage

Examples

Use the size prop to change the size of the tabs.

Variants

Use the variant prop to change the appearance of the tabs.

Orientation

Use the orientation prop to change the orientation of the tabs.

Lazy Loading

Optimize performance by using the lazyMount and unmountOnExit props to conditionally render tab content.

Tab 1: Content 0

Fitted

Use the fitted prop to make the tabs fit the width of the container.

Props

Root

PropDefaultType
size'md'
'xs' | 'sm' | 'md' | 'lg'
variant'line'
'line' | 'subtle' | 'enclosed'
activationMode\automatic\
'manual' | 'automatic'

The activation mode of the tabs. Can be `manual` or `automatic` - `manual`: Tabs are activated when clicked or press `enter` key. - `automatic`: Tabs are activated when receiving focus

lazyMountfalse
boolean

Whether to enable lazy mounting

loopFocustrue
boolean

Whether the keyboard navigation will loop from last tab to first, and vice versa.

orientation\horizontal\
'horizontal' | 'vertical'

The orientation of the tabs. Can be `horizontal` or `vertical` - `horizontal`: only left and right arrow key navigation will work. - `vertical`: only up and down arrow key navigation will work.

unmountOnExitfalse
boolean

Whether to unmount on exit.

fitted
boolean
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

composite
boolean

Whether the tab is composite

defaultValue
string

The initial selected tab value when rendered. Use when you don't need to control the selected tab value.

deselectable
boolean

Whether the active tab can be deselected when clicking on it.

id
string

The unique identifier of the machine.

ids
Partial<{ root: string; trigger: string; list: string; content: string; indicator: string }>

The ids of the elements in the tabs. Useful for composition.

navigate
(details: NavigateDetails) => void

Function to navigate to the selected tab when clicking on it. Useful if tab triggers are anchor elements.

onFocusChange
(details: FocusChangeDetails) => void

Callback to be called when the focused tab changes

onValueChange
(details: ValueChangeDetails) => void

Callback to be called when the selected/active tab changes

translations
IntlTranslations

Specifies the localized strings that identifies the accessibility elements and their states

value
string

The controlled selected tab value

TabContent

PropDefaultType
value*
string

The value of the tab

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

TabTrigger

PropDefaultType
value*
string

The value of the tab

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

disabled
boolean

Whether the tab is disabled