Introduction
Components
- Accordion
- Action Sheet
- Alert
- Audio Player
- Audio Recorder
- Audio Waveform
- Avatar
- Badge
- BottomSheet
- Button
- Camera
- Camera Preview
- Card
- Carousel
- Checkbox
- Collapsible
- Color Picker
- Combobox
- Date Picker
- File Picker
- Gallery
- Hello Wave
- Icon
- Image
- Input
- Input OTP
- Link
- MediaPicker
- Mode Toggle
- Onboarding
- ParallaxScrollView
- Picker
- Popover
- Progress
- Radio
- ScrollView
- SearchBar
- Separator
- Share
- Sheet
- Skeleton
- Spinner
- Switch
- Table
- Tabs
- Text
- Toast
- Toggle
- Video
- View
Charts
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { Text } from '@/components/ui/text';
import { View } from '@/components/ui/view';
import React from 'react';
export function TabsDemo() {
return (
<Tabs defaultValue='account' style={{ width: 400 }}>
<TabsList>
<TabsTrigger value='account'>Account</TabsTrigger>
<TabsTrigger value='followers'>Followers</TabsTrigger>
<TabsTrigger value='following'>Following</TabsTrigger>
<TabsTrigger value='password'>Password</TabsTrigger>
<TabsTrigger value='settings'>Settings</TabsTrigger>
<TabsTrigger value='more'>More</TabsTrigger>
</TabsList>
<TabsContent value='account'>
<View style={{ paddingHorizontal: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
Account Settings
</Text>
<Text variant='body'>
Manage your account information and preferences here.
</Text>
</View>
</TabsContent>
<TabsContent value='followers'>
<View style={{ paddingHorizontal: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
Followers
</Text>
<Text variant='body'>
Manage your followers information and preferences here.
</Text>
</View>
</TabsContent>
<TabsContent value='following'>
<View style={{ paddingHorizontal: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
Following
</Text>
<Text variant='body'>
Manage your following information and preferences here.
</Text>
</View>
</TabsContent>
<TabsContent value='password'>
<View style={{ paddingHorizontal: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
Password Settings
</Text>
<Text variant='body'>
Change your password and security settings preferences here.
</Text>
</View>
</TabsContent>
<TabsContent value='settings'>
<View style={{ paddingHorizontal: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
General Settings
</Text>
<Text variant='body'>
Configure your application preferences and options.
</Text>
</View>
</TabsContent>
<TabsContent value='more'>
<View style={{ paddingHorizontal: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
More
</Text>
<Text variant='body'>
Configure your application preferences and options.
</Text>
</View>
</TabsContent>
</Tabs>
);
}
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
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { Text } from '@/components/ui/text';
import { View } from '@/components/ui/view';
import React from 'react';
export function TabsDemo() {
return (
<Tabs defaultValue='account' style={{ width: 400 }}>
<TabsList>
<TabsTrigger value='account'>Account</TabsTrigger>
<TabsTrigger value='followers'>Followers</TabsTrigger>
<TabsTrigger value='following'>Following</TabsTrigger>
<TabsTrigger value='password'>Password</TabsTrigger>
<TabsTrigger value='settings'>Settings</TabsTrigger>
<TabsTrigger value='more'>More</TabsTrigger>
</TabsList>
<TabsContent value='account'>
<View style={{ paddingHorizontal: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
Account Settings
</Text>
<Text variant='body'>
Manage your account information and preferences here.
</Text>
</View>
</TabsContent>
<TabsContent value='followers'>
<View style={{ paddingHorizontal: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
Followers
</Text>
<Text variant='body'>
Manage your followers information and preferences here.
</Text>
</View>
</TabsContent>
<TabsContent value='following'>
<View style={{ paddingHorizontal: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
Following
</Text>
<Text variant='body'>
Manage your following information and preferences here.
</Text>
</View>
</TabsContent>
<TabsContent value='password'>
<View style={{ paddingHorizontal: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
Password Settings
</Text>
<Text variant='body'>
Change your password and security settings preferences here.
</Text>
</View>
</TabsContent>
<TabsContent value='settings'>
<View style={{ paddingHorizontal: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
General Settings
</Text>
<Text variant='body'>
Configure your application preferences and options.
</Text>
</View>
</TabsContent>
<TabsContent value='more'>
<View style={{ paddingHorizontal: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
More
</Text>
<Text variant='body'>
Configure your application preferences and options.
</Text>
</View>
</TabsContent>
</Tabs>
);
}
Vertical Orientation
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { Text } from '@/components/ui/text';
import { View } from '@/components/ui/view';
import React from 'react';
export function TabsVertical() {
return (
<Tabs defaultValue='profile' orientation='vertical'>
<TabsList>
<TabsTrigger value='profile'>🧑💼</TabsTrigger>
<TabsTrigger value='security'></TabsTrigger>
<TabsTrigger value='notifications'>🔔</TabsTrigger>
<TabsTrigger value='billing'>💰</TabsTrigger>
</TabsList>
<TabsContent value='profile' style={{ flex: 1 }}>
<View style={{ marginHorizontal: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
Profile Information
</Text>
<Text variant='body'>
Update your personal information and profile picture.
</Text>
</View>
</TabsContent>
<TabsContent value='security' style={{ flex: 1 }}>
<View style={{ marginHorizontal: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
Security Settings
</Text>
<Text variant='body'>
Manage two-factor authentication and login security.
</Text>
</View>
</TabsContent>
<TabsContent value='notifications' style={{ flex: 1 }}>
<View style={{ marginHorizontal: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
Notification Preferences
</Text>
<Text variant='body'>
Configure how and when you receive notifications.
</Text>
</View>
</TabsContent>
<TabsContent value='billing' style={{ flex: 1 }}>
<View style={{ marginHorizontal: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
Billing & Subscription
</Text>
<Text variant='body'>
Manage your subscription and payment methods.
</Text>
</View>
</TabsContent>
</Tabs>
);
}
Disabled Tabs
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { Text } from '@/components/ui/text';
import { View } from '@/components/ui/view';
import React from 'react';
export function TabsDisabled() {
return (
<Tabs defaultValue='available' style={{ width: 400 }}>
<TabsList>
<TabsTrigger value='available'>Available</TabsTrigger>
<TabsTrigger value='pending'>Pending</TabsTrigger>
<TabsTrigger value='premium' disabled>
Premium
</TabsTrigger>
<TabsTrigger value='enterprise' disabled>
Enterprise
</TabsTrigger>
</TabsList>
<TabsContent value='available'>
<View style={{ padding: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
Available Features
</Text>
<Text variant='body'>
These features are currently available to you.
</Text>
</View>
</TabsContent>
<TabsContent value='pending'>
<View style={{ padding: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
Pending Features
</Text>
<Text variant='body'>
These features are being processed and will be available soon.
</Text>
</View>
</TabsContent>
<TabsContent value='premium'>
<View style={{ padding: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
Premium Features
</Text>
<Text variant='body'>Upgrade to access premium features.</Text>
</View>
</TabsContent>
<TabsContent value='enterprise'>
<View style={{ padding: 16 }}>
<Text variant='title' style={{ marginBottom: 8 }}>
Enterprise Features
</Text>
<Text variant='body'>Contact sales for enterprise features.</Text>
</View>
</TabsContent>
</Tabs>
);
}
Custom Styling
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { Text } from '@/components/ui/text';
import { View } from '@/components/ui/view';
import { useState } from 'react';
export function TabsStyled() {
const [value, setValue] = useState('design');
return (
<Tabs value={value} onValueChange={setValue}>
<TabsList
style={{
backgroundColor:
value === 'design'
? '#3b82f6'
: value === 'development'
? '#10b981'
: '#f59e0b',
shadowColor: '#000',
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.1,
shadowRadius: 4,
elevation: 3,
borderRadius: 8,
}}
>
<TabsTrigger
value='design'
style={{ borderRadius: 8 }}
textStyle={{ fontWeight: '600', color: '#3b82f6' }}
>
Design
</TabsTrigger>
<TabsTrigger
value='development'
style={{ borderRadius: 8 }}
textStyle={{ fontWeight: '600', color: '#10b981' }}
>
Development
</TabsTrigger>
<TabsTrigger
value='testing'
style={{ borderRadius: 8 }}
textStyle={{ fontWeight: '600', color: '#f59e0b' }}
>
Testing
</TabsTrigger>
</TabsList>
<TabsContent value='design'>
<View
style={{
padding: 20,
backgroundColor: '#eff6ff',
borderRadius: 12,
marginTop: 8,
}}
>
<Text variant='title' style={{ color: '#1e40af', marginBottom: 8 }}>
Design Phase
</Text>
<Text variant='body' style={{ color: '#1e40af' }}>
Create wireframes, mockups, and design systems for your project.
</Text>
</View>
</TabsContent>
<TabsContent value='development'>
<View
style={{
padding: 20,
backgroundColor: '#ecfdf5',
borderRadius: 12,
marginTop: 8,
}}
>
<Text variant='title' style={{ color: '#047857', marginBottom: 8 }}>
Development Phase
</Text>
<Text variant='body' style={{ color: '#047857' }}>
Build and implement the features based on the design specifications.
</Text>
</View>
</TabsContent>
<TabsContent value='testing'>
<View
style={{
padding: 20,
backgroundColor: '#fffbeb',
borderRadius: 12,
marginTop: 8,
}}
>
<Text variant='title' style={{ color: '#92400e', marginBottom: 8 }}>
Testing Phase
</Text>
<Text variant='body' style={{ color: '#92400e' }}>
Perform quality assurance and user acceptance testing.
</Text>
</View>
</TabsContent>
</Tabs>
);
}
API Reference
Tabs
The root container for the tabs component.
Prop | Type | Default | Description |
---|---|---|---|
children | ReactNode | - | The tabs list and content components. |
defaultValue | string | - | The value of the tab that should be active by default. |
orientation | 'horizontal' | 'vertical' | 'horizontal' | The orientation of the tabs. |
style | ViewStyle | - | Additional styles to apply to the container. |
TabsList
Container for the tab triggers.
Prop | Type | Default | Description |
---|---|---|---|
children | ReactNode | - | The tab trigger components. |
style | ViewStyle | - | Additional styles to apply to the tabs list. |
TabsTrigger
The clickable tab that activates its associated content.
Prop | Type | Default | Description |
---|---|---|---|
children | ReactNode | - | The content of the tab trigger (usually text). |
value | string | - | The unique value that identifies this tab. |
disabled | boolean | false | Whether the tab is disabled. |
style | ViewStyle | - | Additional styles to apply to the trigger. |
textStyle | TextStyle | - | Additional styles to apply to the trigger text. |
TabsContent
The content panel associated with a tab trigger.
Prop | Type | Default | Description |
---|---|---|---|
children | ReactNode | - | The content to display when the tab is active. |
value | string | - | The value that matches the associated trigger. |
style | ViewStyle | - | 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