Skip to content

Tabs

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

TabsExample.tsx
import { useState } from 'react';
import { Tabs, TabsList, TabsTrigger, TabsContent, Text, Box } from '@masumdev/rn-ui';
export function TabsExample() {
const [activeTab, setActiveTab] = useState('overview');
return (
<Tabs value={activeTab} onValueChange={setActiveTab} variant="line">
<TabsList>
<TabsTrigger value="overview">Overview</TabsTrigger>
<TabsTrigger value="analytics" badge="3">Analytics</TabsTrigger>
<TabsTrigger value="settings">Settings</TabsTrigger>
</TabsList>
<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>
</Box>
</TabsContent>
<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>
</Box>
</TabsContent>
<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>
</Box>
</TabsContent>
</Tabs>
);
}

Pill Variant

PillTabs.tsx
import { Tabs, TabsList, TabsTrigger, TabsContent, Text } from '@masumdev/rn-ui';
<Tabs defaultValue="week" variant="pill" tone="accent">
<TabsList>
<TabsTrigger value="day">Day</TabsTrigger>
<TabsTrigger value="week">Week</TabsTrigger>
<TabsTrigger value="month">Month</TabsTrigger>
</TabsList>
<TabsContent value="day"><Text>Daily summary</Text></TabsContent>
<TabsContent value="week"><Text>Weekly summary</Text></TabsContent>
<TabsContent value="month"><Text>Monthly summary</Text></TabsContent>
</Tabs>

Props API

Tabs

PropTypeDefaultDescription
valuestring—Controlled active tab identifier.
defaultValuestring""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.
toneComponentTone"primary"Semantic color intent for active indicator and text.
sizeComponentSize"md"Dimension scale preset (sm, md, lg).
hapticbooleantrueEnable tactile haptic feedback on tab selection.
glassbooleanfalseEnable translucent glassmorphism background styling.
animatedbooleantrueEnable smooth indicator sliding worklet transitions.
transition"slide" | "fade" | "scale" | "none""slide"Content panel entrance transition adhering to expo-animation.

TabsList

PropTypeDefaultDescription
fullWidthbooleanfalseDistribute triggers evenly across the full width of the container.
styleStyleProp<ViewStyle>—Style overrides for the tab list container.
indicatorStyleStyleProp<ViewStyle>—Style overrides for the sliding indicator.
children*ReactNode—TabsTrigger elements.

TabsTrigger

PropTypeDefaultDescription
value*string—Unique identifier corresponding to a TabsContent panel.
disabledbooleanfalseWhether the tab trigger is disabled.
iconRenderIcon—Leading icon element or render function.
badgestring | number—Notification badge count or label.
styleStyleProp<ViewStyle>—Style overrides for the tab button.
textStyleStyleProp<TextStyle>—Text style overrides for the tab label.
activeTextStyleStyleProp<TextStyle>—Text style overrides applied when selected.

TabsContent

PropTypeDefaultDescription
value*string—Matches the value of the trigger that reveals this panel.
lazybooleantrueWhether inactive tab content is unmounted.
transition"slide" | "fade" | "scale" | "none"—Override the container transition specifically for this panel.
styleStyleProp<ViewStyle>—Style overrides for the content panel wrapper.
children*ReactNode—Panel content elements.