Tab.Item
Individual tab item component with icon support, active/inactive states, and theme integration
- Stable unknown
- Release candidate since 1.16.1-rc.3
- Development since 1.16.1-dev.2111+9796905
Individual tab item component that represents a single tab within a Tab container. Supports icons, custom styling for active/inactive states, and theme integration with automatic color management.
Quick Example
import { Tab } from "@ovok/native";
import { Home, Settings, User } from "iconsax-react-nativejs";
import React from "react";
export const TabItemExample = () => {
const [activeTab, setActiveTab] = React.useState("home");
return (
<Tab value={activeTab} onChange={setActiveTab}>
<Tab.Item value="home" icon={(color) => <Home size={20} color={color} />}>
Home
</Tab.Item>
<Tab.Item
value="profile"
icon={(color) => <User size={20} color={color} />}
>
Profile
</Tab.Item>
<Tab.Item
value="settings"
icon={(color) => <Settings size={20} color={color} />}
>
Settings
</Tab.Item>
</Tab>
);
};
export default TabItemExample;Props
Every prop, with its type and description, is listed in the @ovok/native/tab API reference.
Component Behavior
The Tab.Item component:
- State Awareness: Automatically detects if it's the active tab using context
- Dynamic Styling: Applies different styles based on active/inactive state
- Color Management: Provides appropriate colors to icon functions
- Event Handling: Handles press events to update tab selection
- Theme Integration: Uses theme colors for consistent appearance
Color System
Tab.Item automatically provides colors to icons and text based on state:
- Active:
theme.colors.primary - Inactive:
theme.colors.onSurfaceDisabled
Styling
Theme Colors Used
theme.colors.primary- Active tab color (text and icon)theme.colors.onSurfaceDisabled- Inactive tab color (text and icon)theme.spacing(1)- Gap between icon and texttheme.spacing(2)- Vertical padding
The component does not add an accessibility role, state, or label automatically.
Related Components
- Tab - Parent container component
Last updated on