BNA

BNA UI
26

A set of layered sections of content—known as tab panels—that are displayed one at a time.

Installation

pnpm dlx bna-ui add tabs

Usage

import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
<Tabs defaultValue='tab1'>
  <TabsList>
    <TabsTrigger value='tab1'>Tab 1</TabsTrigger>
    <TabsTrigger value='tab2'>Tab 2</TabsTrigger>
    <TabsTrigger value='tab3'>Tab 3</TabsTrigger>
  </TabsList>
  <TabsContent value='tab1'>
    <Text>Content for Tab 1</Text>
  </TabsContent>
  <TabsContent value='tab2'>
    <Text>Content for Tab 2</Text>
  </TabsContent>
  <TabsContent value='tab3'>
    <Text>Content for Tab 3</Text>
  </TabsContent>
</Tabs>

Examples

Default

Vertical Orientation

Disabled Tabs

Custom Styling

API Reference

Tabs

The root container for the tabs component.

PropTypeDefaultDescription
childrenReactNode-The tabs list and content components.
defaultValuestring-The value of the tab that should be active by default.
orientation'horizontal' | 'vertical''horizontal'The orientation of the tabs.
styleViewStyle-Additional styles to apply to the container.

TabsList

Container for the tab triggers.

PropTypeDefaultDescription
childrenReactNode-The tab trigger components.
styleViewStyle-Additional styles to apply to the tabs list.

TabsTrigger

The clickable tab that activates its associated content.

PropTypeDefaultDescription
childrenReactNode-The content of the tab trigger (usually text).
valuestring-The unique value that identifies this tab.
disabledbooleanfalseWhether the tab is disabled.
styleViewStyle-Additional styles to apply to the trigger.
textStyleTextStyle-Additional styles to apply to the trigger text.

TabsContent

The content panel associated with a tab trigger.

PropTypeDefaultDescription
childrenReactNode-The content to display when the tab is active.
valuestring-The value that matches the associated trigger.
styleViewStyle-Additional styles to apply to the content.

Accessibility

The Tabs component is built with accessibility in mind:

  • Uses proper ARIA roles and properties for screen readers
  • Supports keyboard navigation between tabs
  • Active tab is properly announced to screen readers
  • Disabled tabs are marked as inaccessible
  • Content is properly associated with its trigger