Backpack UI
Components
Tabs

Tabs

This documentation covers the Tabs component, which is a set of components for creating tabs with customizable styles and behavior. The component is built on top of the Radix UI library.


Account

Importing

To use the Tabs component, import it as follows:


_10
import { Tabs } from '@ef-global/backpack/Tabs';

Components

The Tabs component consists of 4 subcomponents:

  1. Tabs.Root
  2. Tabs.List
  3. Tabs.Trigger
  4. Tabs.Content

Tabs.Root

This is the root container for the tabs.

PropTypeDescription
classNamestringAdditional class name(s) for the root.
defaultValuestringThe default tab value.
valuestringThe currently active tab value.
onValueChangefunctionCallback when the active tab changes.
childrenReactNodeChild components within the root.

Tabs.List

This is the container for the tab triggers.

PropTypeDescription
classNamestringAdditional class name(s) for the list.
ariaLabelstringARIA label for accessibility purposes.
childrenReactNodeChild components within the list (triggers).

Tabs.Trigger

This is the tab trigger button.

PropTypeDescription
classNamestringAdditional class name(s) for the tab.
valuestringThe value of the tab.
childrenReactNodeChild components within the trigger.

Tabs.Content

This is the content container for each tab.

PropTypeDescription
classNamestringAdditional class name(s) for the content.
valuestringThe value of the tab.
childrenReactNodeChild components within the content.

Example


Account

_12
<Tabs.Root defaultValue='account'>
_12
<Tabs.List aria-label='Manage your account'>
_12
<Tabs.Trigger value='account'>Account</Tabs.Trigger>
_12
<Tabs.Trigger value='password'>Password</Tabs.Trigger>
_12
</Tabs.List>
_12
<Tabs.Content value='account'>
_12
<div>Account</div>
_12
</Tabs.Content>
_12
<Tabs.Content value='password'>
_12
<div>Password</div>
_12
</Tabs.Content>
_12
</Tabs.Root>