Tabs provides an accessible, compound tab navigation primitive with zero-bounce timing worklet indicator transitions, supporting line, pill capsule, soft tint, and container-flush styling.
Usage
import { useState } from 'react';
import { Tabs, TabsList, TabsTrigger, TabsContent, Text, Box } from '@masumdev/rn-ui';
export function TabsExample() {
const [activeTab, setActiveTab] = useState('overview');
<Tabs value={activeTab} onValueChange={setActiveTab} variant="line">
<TabsTrigger value="overview">Overview</TabsTrigger>
<TabsTrigger value="analytics" badge="3">Analytics</TabsTrigger>
<TabsTrigger value="settings">Settings</TabsTrigger>
<TabsContent value="overview">
<Box p="md" bg="surfaceMuted" style={{ borderRadius: 8 }}>
<Text weight="600">Overview Panel</Text>
<Text color="textMuted">Welcome to the workspace overview.</Text>
<TabsContent value="analytics">
<Box p="md" bg="surfaceMuted" style={{ borderRadius: 8 }}>
<Text weight="600">Analytics Panel</Text>
<Text color="textMuted">Daily metrics and user telemetry data.</Text>
<TabsContent value="settings">
<Box p="md" bg="surfaceMuted" style={{ borderRadius: 8 }}>
<Text weight="600">Settings Panel</Text>
<Text color="textMuted">Configure account and security preferences.</Text>
Pill Variant
import { Tabs, TabsList, TabsTrigger, TabsContent, Text } from '@masumdev/rn-ui';
<Tabs defaultValue="week" variant="pill" tone="accent">
<TabsTrigger value="day">Day</TabsTrigger>
<TabsTrigger value="week">Week</TabsTrigger>
<TabsTrigger value="month">Month</TabsTrigger>
<TabsContent value="day"><Text>Daily summary</Text></TabsContent>
<TabsContent value="week"><Text>Weekly summary</Text></TabsContent>
<TabsContent value="month"><Text>Monthly summary</Text></TabsContent>
Props API
Tabs
| Prop | Type | Default | Description |
|---|
value | string | — | Controlled active tab identifier. |
defaultValue | string | "" | Initial active tab identifier. |
onValueChange | (value: string) => void | — | Callback invoked when active tab changes. |
variant | "line" | "pill" | "soft" | "flush" | "line" | Visual structure of the tabs and active indicator. |
tone | ComponentTone | "primary" | Semantic color intent for active indicator and text. |
size | ComponentSize | "md" | Dimension scale preset (sm, md, lg). |
haptic | boolean | true | Enable tactile haptic feedback on tab selection. |
glass | boolean | false | Enable translucent glassmorphism background styling. |
animated | boolean | true | Enable smooth indicator sliding worklet transitions. |
transition | "slide" | "fade" | "scale" | "none" | "slide" | Content panel entrance transition adhering to expo-animation. |
TabsList
| Prop | Type | Default | Description |
|---|
fullWidth | boolean | false | Distribute triggers evenly across the full width of the container. |
style | StyleProp<ViewStyle> | — | Style overrides for the tab list container. |
indicatorStyle | StyleProp<ViewStyle> | — | Style overrides for the sliding indicator. |
children* | ReactNode | — | TabsTrigger elements. |
TabsTrigger
| Prop | Type | Default | Description |
|---|
value* | string | — | Unique identifier corresponding to a TabsContent panel. |
disabled | boolean | false | Whether the tab trigger is disabled. |
icon | RenderIcon | — | Leading icon element or render function. |
badge | string | number | — | Notification badge count or label. |
style | StyleProp<ViewStyle> | — | Style overrides for the tab button. |
textStyle | StyleProp<TextStyle> | — | Text style overrides for the tab label. |
activeTextStyle | StyleProp<TextStyle> | — | Text style overrides applied when selected. |
TabsContent
| Prop | Type | Default | Description |
|---|
value* | string | — | Matches the value of the trigger that reveals this panel. |
lazy | boolean | true | Whether inactive tab content is unmounted. |
transition | "slide" | "fade" | "scale" | "none" | — | Override the container transition specifically for this panel. |
style | StyleProp<ViewStyle> | — | Style overrides for the content panel wrapper. |
children* | ReactNode | — | Panel content elements. |