Homelogologo
Sponsor

Tabs

Displays content in a tabbed interface

Usage

Use Tabs to organize related content into a tabbed interface. Place your tab controls inside Tabs.List, optionally include Tabs.Indicator for an active-state underline or highlight, and render one Tabs.Content panel per tab.

import { Tabs, Text } from "@elemnts-ui/react"; <Tabs defaultValue="tab-1"> <Tabs.List> <Tabs.Trigger value="tab-1">Tab 1</Tabs.Trigger> <Tabs.Trigger value="tab-2">Tab 2</Tabs.Trigger> <Tabs.Indicator /> </Tabs.List> <Tabs.Content value="tab-1"> <Text>Tab 1 Content</Text> </Tabs.Content> <Tabs.Content value="tab-2"> <Text>Tab 2 Content</Text> </Tabs.Content> </Tabs>;

Vertical

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

Disabled

Set the disabled prop on Tabs.Trigger to disable a specific tab.

Sizes

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

Variants

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

API Reference

Tabs

The root component that manages tab state.

PropTypeDefault
activationMode"manual" | "automatic""automatic"
asChildbooleanfalse
compositeboolean-
defaultValuestring-
deselectableboolean-
hideModeHideMode"display-none"
idstring-
idsPartial<{ root: string; trigger: (value: string) => string; list: string; content: (value: string) => string; indicator: string }>-
lazyMountbooleanfalse
loopFocusbooleantrue
navigate(details: NavigateDetails) => void-
onFocusChange(details: FocusChangeDetails) => void-
onValueChange(details: ValueChangeDetails) => void-
orientation"horizontal" | "vertical""horizontal"
size"xs" | "sm" | "md" | "lg" | "xl""md"
translationsIntlTranslations-
unmountOnExitbooleanfalse
valuestring-
variant"primary" | "secondary" | "tertiary""primary"

TabsRootProvider

Provides a tabs state machine created with useTabs.

PropTypeDefault
valueUseTabsReturnrequired
asChildbooleanfalse
hideModeHideMode"display-none"
lazyMountbooleanfalse
unmountOnExitbooleanfalse

TabsContext

Provides access to tabs state and helpers.

TabsList

Wraps the set of tab triggers.

PropTypeDefault
asChildbooleanfalse

TabsTrigger

A control that activates its associated tab.

PropTypeDefault
valuestringrequired
asChildbooleanfalse
disabledboolean-

TabsIndicator

A visual indicator that tracks the active tab.

PropTypeDefault
asChildbooleanfalse

TabsContent

The content panel associated with a tab.

PropTypeDefault
valuestringrequired
asChildbooleanfalse

TabsPanel

A styled container for content inside TabsContent.

PropTypeDefault
asChildbooleanfalse