Tabs Primitive
A collection of layered content sections, referred to as tab panels, displayed individually.
Installation
Install the component via your command line.
Install @radix-ui/react-tabs
Copy/paste the following code for web to ~/components/primitives/tabs/tabs.web.tsx
Copy/paste the following code for native to ~/components/primitives/tabs/tabs.tsx
Copy/paste the following code for types to ~/components/primitives/tabs/types.ts
Copy/paste the following code for exporting to ~/components/primitives/tabs/index.ts
Copy/paste the following code for native to ~/components/primitives/tabs/index.tsx
Copy/paste the following code for types to ~/components/primitives/tabs/types.ts
Usage
Props
Root
Extends View
props
Prop | Type | Note |
---|---|---|
value | string | |
onValueChange | (value: string ) => void | |
asChild | boolean | (optional) |
disabled | boolean | (optional) |
orientation | ’horizontal’ | ‘vertical’ | Web Only (optional) |
dir | ’ltr’ | ‘rtl’ | Web Only (optional) |
activationMode | ’automatic’ | ‘manual’ | Web Only (optional) |
List
Extends View
props
Prop | Type | Note |
---|---|---|
asChild | boolean | (optional) |
Trigger
Extends Pressable
props
Prop | Type | Note |
---|---|---|
asChild | boolean | (optional) |
Content
Extends View
props
Prop | Type | Note |
---|---|---|
value | string | |
forceMount | boolean | (optional) |
asChild | boolean | (optional) |
useRootContext
Must be used within a Root
component. It provides the following values from the dropdown menu: value
, and onValueChange
.
useTriggerContext
Must be used within a Trigger
component. It provides the following values from the dropdown menu: value
.