Skip to main content
Version: 5.1.3

Tab

Tabs organize content across different screens, data sets, and other interactions.

note

This component is not for (complex) navigation. Use React Navigation for that.

Import

import { Tab } from '@rn-vui/themed';

Theme Key

Tab

Usage

Basic Tabs

function RneTab() {
const [index, setIndex] = React.useState(0);
return (
<>
<Tab value={index} onChange={setIndex} dense>
<Tab.Item>Tab</Tab.Item>
<Tab.Item>Tab</Tab.Item>
</Tab>
</>
);
}

Active Tab Items

<Tab value={0} scrollable>
<Tab.Item
containerStyle={(active) => ({
backgroundColor: active ? "red" : undefined,
})}
>
Tab
</Tab.Item>
<Tab.Item
buttonStyle={(active) => ({
backgroundColor: active ? "red" : undefined,
})}
>
Tab
</Tab.Item>
</Tab>

Props

note

Includes all View props.

NameTypeDefaultDescription
animationConfigTimingAnimationConfig | SpringAnimationConfig(Object){}Animation Config
animationTypespring | timingspringAnimation type
buttonStyleViewStyle or (active: boolean) => ViewStylenoneAdditional button style
containerStyleViewStyle or (active: boolean) => ViewStylenoneAdditional Styling for button container.
densebooleannoneDense Tab Item
disableIndicatorbooleanDisable the indicator below.
iconPositionleft | right | top | bottomnone
indicatorStyleView StyleAdditional styling for tab indicator.
onChange(value: number) => voidFunctionOn Index Change Callback.
scrollablebooleanfalseMakes Tab Scrolling
titleStyleTextStyle or (active: boolean) => TextStylenoneAdditional button title style
valuenumberactive index
variantprimary | defaultprimaryDefine the background Variant.

Playground

Loading...