Tabs
Use in pages to manage sub-pages
Tabs organizes related panels behind a controlled or uncontrolled, keyboard-navigable list of triggers.
Features
Accessible, composable, customizable, and animatable
Sizing with controlled or uncontrolled state
Automatic and manual activation modes
Full keyboard navigation
Installation
Tabs is already installed in tamagui, or you can install it independently:
yarn
npm
bun
pnpm
Usage
Headless usage
To use headless tabs without @tamagui/core, install @tamagui/tabs-headless:
yarn
npm
bun
pnpm
The useTabs hook provides all the state and accessibility props needed to build custom tabs with any styling solution:
API reference
Tabs
Root tabs component. Extends View. Passing the size prop to this component will affect the descendants.
Props
value
string
The value for the selected tab, if controlled.
defaultValue
string
The value of the tab to select by default, if uncontrolled.
onValueChange
(value: string) => void
A function called when a new tab is selected.
orientation
"horizontal" | "vertical"
Default:
horizontalThe orientation the tabs are laid out in.
dir
"ltr" | "rtl"
The direction of navigation between toolbar items.
activationMode
"manual" | "automatic"
Default:
automaticWhether a tab is activated automatically (on focus) or manually (on click/enter). Automatic activation is web-only; native always activates manually.
size
'xs' | 'sm' | 'md' | 'lg' | 'xl'
Default:
mdSets the size of the tab triggers. Passed down via context to all Tabs.Tab children.
loop
boolean
Default:
trueWhether keyboard navigation should loop from last to first and vice versa.
Tabs.List
Container for the trigger buttons. Supports scrolling by extending Group.
Props
loop
boolean
Default:
trueWhether or not to loop over after reaching the end or start of the items. Used mainly for managing keyboard navigation.
Since Tabs.List extends Group, the same limitation applies: automatic border radius
detection only works when Tabs.Tab is a direct child of Tabs.List. If you wrap
tabs in custom components, see the Group docs on nested
items for workarounds.
Tabs.Tab
Extends YStack, adding:
Props
value
string
The value for the tabs state to be changed to after activation of the trigger.
onInteraction
(type: InteractionType, layout: TabLayout | null) => void
Used for making custom indicators when trigger is interacted with.
disabled
boolean
Whether the tab is disabled.
unstyled
boolean
When true, removes all default Tamagui styling.
activeStyle
StylePiece
Styles to apply when the tab is selected. Accepts a style() piece.
activeTheme
string | null
Theme to apply when the tab is selected. Set to null for no theme change.
Tabs.Content
Where each tab’s content will be shown. Extends YStack, adding:
Props
value
string
Will show the content when the value matches the state of Tabs root.
forceMount
boolean
Default:
falseUsed to force mounting when more control is needed. Useful when controlling animation with Tamagui animations.
Headless props
useTabs return value
| Property | Type | Description |
|---|---|---|
value | string | The currently selected tab value |
setValue | (value: string) => void | Function to change the selected tab |
direction | 'ltr' | 'rtl' | The resolved text direction |
tabsProps | object | Props to spread on the tabs container |
listProps | object | Props to spread on the tab list |
getTabProps | (value: string, disabled?: boolean) => object | Get props for a tab trigger |
getContentProps | (value: string) => object | Get props for a tab content panel |
contextValue | TabsContextValue | Context value for component-based API |
- Property
value- Type
string- Description
- The currently selected tab value
- Property
setValue- Type
(value: string) => void- Description
- Function to change the selected tab
- Property
direction- Type
'ltr' | 'rtl'- Description
- The resolved text direction
- Property
tabsProps- Type
object- Description
- Props to spread on the tabs container
- Property
listProps- Type
object- Description
- Props to spread on the tab list
- Property
getTabProps- Type
(value: string, disabled?: boolean) => object- Description
- Get props for a tab trigger
- Property
getContentProps- Type
(value: string) => object- Description
- Get props for a tab content panel
- Property
contextValue- Type
TabsContextValue- Description
- Context value for component-based API
useTab
Hook for individual tab triggers when using the component-based API.
useTabContent
Hook for tab content panels when using the component-based API.
Examples
Animations
Here is a demo with more advanced animations using AnimatePresence and Tabs.Tab’s onInteraction prop.
Source
v2-look Tabs: token-based trigger sizing with theme background, hover/press/focus styling, and disabled dimming over the unstyled @tamagui/ui Tabs behavior. This is the exact source the registry ships — copy it into your app and the examples above import from your copy.
components/tamagui/Tabs.tsxDependencies
yarn add @tamagui/core @tamagui/tabs @tamagui/textExpects theme tokens: background, background-hover, background-press, outline-color.
Need raw behavior without any skin? tamagui/unstyled re-exports the @tamagui/ui primitives (advanced).