--- title: gluestack-ui Tabs Component | React Native Tabs Installation description: Create an organized UI using the gluestack-ui Tabs component in React & React Native. Add tabbed navigation seamlessly with animations. pageTitle: Tabs pageDescription: Create an organized UI using the gluestack-ui Tabs component in React & React Native. Add tabbed navigation seamlessly with animations. showHeader: true --- import { Tabs as DocTabs, TabItem } from '@/docs-components/tabs'; import { Table, TableHeader, TableCell, TableHeaderCell, TableBody, TableRow, } from '@/docs-components/table'; import { InlineCode } from '@/docs-components/inline-code'; import { AnatomyImage } from '@/docs-components/anatomy-image'; # Tabs Create an organized UI using the gluestack-ui Tabs component in React & React Native. Add tabbed navigation seamlessly with animations. This is an illustration of **Tabs** component. /// {Example:basic} ///
## Installation ### Run the following command: > Note: At present, we have integrated `react-native-reanimated` for animations. You have the option to remove this and implement your own custom animation wrapper. ### Step 1: Install the following dependencies: ```bash npm i react-native-reanimated ``` ### Step 2: Copy and paste the following code into your project. ```jsx %%-- File: src/components/ui/tabs/index.tsx --%% ``` ```jsx %%-- File: src/components/ui/tabs/TabsAnimatedIndicator.tsx --%% ``` ```jsx %%-- File: src/components/ui/tabs/animation-config.ts --%% ``` ### Step 3: Update the import paths to match your project setup. ## API Reference To use this component in your project, include the following import statement in your file. ```ts import { Tabs, TabsList, TabsTrigger, TabsContent, TabsTriggerText, TabsTriggerIcon, TabsIndicator, } from '@/components/ui/tabs'; ``` ```tsx export default () => ( Tab 1 Tab 2 Content for Tab 1 Content for Tab 2 ); ``` ### Component Props This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration. #### Tabs Contains all the tabs component parts. Prop Type Default Description value string - The controlled value of the tab to activate. Use with onValueChange. defaultValue string - The value of the tab that should be active when initially rendered. Use when you do not need to control the state. onValueChange (value: string) => void - Event handler called when the value changes. orientation 'horizontal' | 'vertical' 'horizontal' The orientation of the tabs. activationMode 'automatic' | 'manual' 'automatic' Whether tabs activate automatically on focus or manually with Enter/Space. disabled boolean false When true, prevents the user from interacting with the tabs. variant 'underlined' | 'filled' 'filled' The visual style variant of the tabs.
#### TabsList Contains the triggers that are aligned along the edge of the active content. Prop Type Default Description scrollable boolean false When true, enables horizontal scrolling for overflow tabs. snapToCenter boolean true When scrollable is true, snaps the selected tab to center.
#### TabsTrigger The button that activates its associated content. Prop Type Default Description value string - A unique value that associates the trigger with a content. disabled boolean false When true, prevents the user from interacting with the tab.
#### TabsContent Contains the content associated with each trigger. Prop Type Default Description value string - A unique value that associates the content with a trigger. forceMount boolean false Used to force mounting when more control is needed. Useful for animation.
#### TabsTriggerText The text displayed within a tab trigger. It inherits all the properties of React Native's [Text](https://reactnative.dev/docs/text) component. #### TabsTriggerIcon The icon displayed within a tab trigger. Prop Type Default Description as React.ComponentType - The icon component to render.
#### TabsIndicator The animated indicator that shows which tab is currently selected. Place this component inside TabsList to control its position. It inherits all the properties of React Native's [View](https://reactnative.dev/docs/view) component. ### Accessibility Adheres to the [Tabs WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/). #### Keyboard Interactions Key Description Tab When focus moves onto the tabs, focuses the active trigger. When a trigger is focused, moves focus to the active content. ArrowDown Moves focus to the next trigger in vertical orientation and activates its associated content. ArrowUp Moves focus to the previous trigger in vertical orientation and activates its associated content. ArrowLeft Moves focus to the previous trigger in horizontal orientation and activates its associated content. ArrowRight Moves focus to the next trigger in horizontal orientation and activates its associated content. Home Moves focus to the first trigger and activates its associated content. End Moves focus to the last trigger and activates its associated content.
## Examples ### With Indicator /// {Example:with-indicator} /// ### Vertical Orientation /// {Example:vertical} /// ### With Icons /// {Example:with-icons} /// ### Variants /// {Example:variants} /// ### Scrollable /// {Example:scrollable} /// ### Controlled /// {Example:controlled} ///