Tab

The Tab component is used for navigating frequently accessed, but distinct categories.

Accessibility

  • tab, shift + tab - to move focus between tabs.
  • Space or Enter - to display the selected tab's content
  • aria-selected, aria-disabled are applied to the tabs.
  • Roles: role=tab, role=tablist, role=tabpanel

Tab Basic Usage

Tab 1 content

Tab Vertical Usage

Tab 3 content

Tab Controlled Usage

Content:
Tab Content 1

Overrides

Additionally, you can fully customize any part of the Tabs through the overrides prop. The Tabs consists of multiple subcomponents that are listed bellow and you can override each one of them. To help you identify the names of these subcomponents, you can highlight them through this selector:

Tab 1 content

Note: You should always use longhand CSS properties. Mixing shorthands and longhands will lead into strange behaviors!

Tabs API

children ChildrenArray<Element<typeof TabPropsT>> required

An array of TabPanel items.

ChildrenArrayElement
children required ChildrenArrayNode
disabled boolean
active boolean
key Key
onClick function Event => mixed
onKeyDown function KeyboardEvent => mixed
onSelect function () => mixed
overrides { Tab: { component: ?ComponentType<<T>>, props: ?{}, style: ?{} | ({}) => ?{} }<<T>> | ComponentType<<T>><<T>> }
$disabled nullable required boolean
$active nullable boolean
$orientation $Values{ horizontal: "horizontal", vertical: "vertical" }
$as string
$style nullable Object
$ref Refany
title Node
&
id string
$orientation $Values{ horizontal: "horizontal", vertical: "vertical" }

activeKey Key required

Key of the the tab to be selected.

Key

disabled boolean = false

If set to true all its tabs will be disabled

onChange function = () => undefined

Change handler that is called every time a new tab is selected

activeKey required Key
=> mixed

orientation $Values<typeof ORIENTATION> =

Sets the orientation of the Tab component

$Values{ horizontal: "horizontal", vertical: "vertical" }

overrides { Root: { component: ?ComponentType<<T>>, props: ?{}, style: ?{} | ({}) => ?{} }<<T>> | ComponentType<<T>><<T>>, TabBar: { component: ?ComponentType<<T>>, props: ?{}, style: ?{} | ({}) => ?{} }<<T>> | ComponentType<<T>><<T>>, TabContent: { component: ?ComponentType<<T>>, props: ?{}, style: ?{} | ({}) => ?{} }<<T>> | ComponentType<<T>><<T>> }<$Diff<object, object>> = {}

{ Root: { component: ?ComponentType<<T>>, props: ?{}, style: ?{} | ({}) => ?{} }<<T>> | ComponentType<<T>><<T>>, TabBar: { component: ?ComponentType<<T>>, props: ?{}, style: ?{} | ({}) => ?{} }<<T>> | ComponentType<<T>><<T>>, TabContent: { component: ?ComponentType<<T>>, props: ?{}, style: ?{} | ({}) => ?{} }<<T>> | ComponentType<<T>><<T>> }$Diff
$disabled nullable required boolean
$active nullable boolean
$orientation $Values{ horizontal: "horizontal", vertical: "vertical" }
$as string
$style nullable Object
$ref Refany
,
$active nullable boolean

StatefulTabs API

initialState object

Initial state of the component

activeKey required Key

stateReducer function = (type, newState) => undefined

A state change handler.

function
$Keys{ change: "change" },
activeKey required Key
,
activeKey required Key
=>
activeKey required Key

TabPanel API

children ChildrenArray<Node> required

ChildrenArrayNode

disabled boolean = false

Sets the tab to disabled

active boolean

key Key

Unique key for the tab. Defaults to the child index.

Key

onClick function = () => undefined

onClick handler for the Tab element

Event => mixed

onKeyDown function = () => undefined

onKeyDown handler for the Tab element

KeyboardEvent => mixed

onSelect function = () => undefined

onSelect handler for the Tab element

() => mixed

overrides { Tab: { component: ?ComponentType<<T>>, props: ?{}, style: ?{} | ({}) => ?{} }<<T>> | ComponentType<<T>><<T>> }<object>

{ Tab: { component: ?ComponentType<<T>>, props: ?{}, style: ?{} | ({}) => ?{} }<<T>> | ComponentType<<T>><<T>> }
$disabled nullable required boolean
$active nullable boolean
$orientation $Values{ horizontal: "horizontal", vertical: "vertical" }
$as string
$style nullable Object
$ref Refany

title Node = ""

Title of the Tab to be shown in the Tab bar

Node

id string

$orientation $Values<typeof ORIENTATION>

$Values{ horizontal: "horizontal", vertical: "vertical" }