Tabs
Make changes to your account here. Click save when you're done.
Features
- Can be controlled or uncontrolled.
 - Supports horizontal/vertical orientation.
 - Supports automatic/manual activation.
 - Full keyboard navigation.
 
Installation
Install the component from your command line.
$ npm add reka-uiAnatomy
Import all parts and piece them together.
<script setup>
import { TabsContent, TabsIndicator, TabsList, TabsRoot, TabsTrigger } from 'reka-ui'
</script>
<template>
  <TabsRoot>
    <TabsList>
      <TabsIndicator />
      <TabsTrigger />
    </TabsList>
    <TabsContent />
  </TabsRoot>
</template>API Reference
Root
Contains all the tabs component parts.
| Prop | Default | Type | 
|---|---|---|
activationMode | 'automatic' | 'automatic' | 'manual'Whether a tab is activated automatically (on focus) or manually (on click).  | 
as | 'div' | AsTag | ComponentThe element or component this component should render as. Can be overwritten by   | 
asChild | booleanChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.  | |
defaultValue | string | numberThe value of the tab that should be active when initially rendered. Use when you do not need to control the state of the tabs  | |
dir | 'ltr' | 'rtl'The reading direction of the combobox when applicable.   | |
modelValue | string | numberThe controlled value of the tab to activate. Can be bind as   | |
orientation | 'horizontal' | 'vertical' | 'horizontal'The orientation the tabs are laid out. Mainly so arrow navigation is done accordingly (left & right vs. up & down)  | 
unmountOnHide | true | booleanWhen   | 
| Emit | Payload | 
|---|---|
update:modelValue | [payload: StringOrNumber]Event handler called when the value changes  | 
| Slots (default) | Payload | 
|---|---|
modelValue | string | numberCurrent input values  | 
| Data Attribute | Value | 
|---|---|
[data-orientation] | "vertical" | "horizontal" | 
List
Contains the triggers that are aligned along the edge of the active content.
| Prop | Default | Type | 
|---|---|---|
as | 'div' | AsTag | ComponentThe element or component this component should render as. Can be overwritten by   | 
asChild | booleanChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.  | |
loop | true | booleanWhen   | 
| Data Attribute | Value | 
|---|---|
[data-orientation] | "vertical" | "horizontal" | 
Trigger
The button that activates its associated content.
| Prop | Default | Type | 
|---|---|---|
as | 'button' | AsTag | ComponentThe element or component this component should render as. Can be overwritten by   | 
asChild | booleanChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.  | |
disabled | false | booleanWhen   | 
value* | string | numberA unique value that associates the trigger with a content.  | 
| Data Attribute | Value | 
|---|---|
[data-state] | "active" | "inactive" | 
[data-disabled] | Present when disabled | 
[data-orientation] | "vertical" | "horizontal" | 
Indicator
The indicator that highlights the current active tab.
| Prop | Default | Type | 
|---|---|---|
as | 'div' | AsTag | ComponentThe element or component this component should render as. Can be overwritten by   | 
asChild | booleanChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.  | 
| CSS Variable | Description | 
|---|---|
--reka-tabs-indicator-size | The size of the indicator.  | 
--reka-tabs-indicator-position | The position of the indicator  | 
Content
Contains the content associated with each trigger.
| Prop | Default | Type | 
|---|---|---|
as | 'div' | AsTag | ComponentThe element or component this component should render as. Can be overwritten by   | 
asChild | booleanChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.  | |
forceMount | booleanUsed to force mounting when more control is needed. Useful when controlling animation with Vue animation libraries.  | |
value* | string | numberA unique value that associates the content with a trigger.  | 
| Data Attribute | Value | 
|---|---|
[data-state] | "active" | "inactive" | 
[data-orientation] | "vertical" | "horizontal" | 
Examples
Vertical
You can create vertical tabs by using the orientation prop.
<script setup>
import { TabsContent, TabsList, TabsRoot, TabsTrigger } from 'reka-ui'
</script>
<template>
  <TabsRoot
    default-value="tab1"
    orientation="vertical"
  >
    <TabsList aria-label="tabs example">
      <TabsTrigger value="tab1">
        One
      </TabsTrigger>
      <TabsTrigger value="tab2">
        Two
      </TabsTrigger>
      <TabsTrigger value="tab3">
        Three
      </TabsTrigger>
    </TabsList>
    <TabsContent value="tab1">
      Tab one content
    </TabsContent>
    <TabsContent value="tab2">
      Tab two content
    </TabsContent>
    <TabsContent value="tab3">
      Tab three content
    </TabsContent>
  </TabsRoot>
</template>Accessibility
Adheres to the Tabs WAI-ARIA design pattern.
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 depending on  orientation and activates its associated content. | 
ArrowRight  |  Moves focus to the next trigger depending on  orientation and activates its associated content. | 
ArrowUp  |  Moves focus to the previous trigger depending on  orientation and activates its associated content. | 
ArrowLeft  |  Moves focus to the previous trigger depending on  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.  | 
