Skip to main content

Tab

Tabs organize and allow navigation between groups of content that are related and at the same level of hierarchy.

The components are as follows:

TabProvider​

It is a provider that wraps Tabs and TabPanels.
It is wrapped in a contextAPI that manages the current tab index.

Tabs​

Group of Tab components.

ARIA roles:

  • role="tablist"

Tab​

Set desired tabId when selecting tab, change color of focused Tab.

ARIA roles:

  • role='tab'
  • aria-selected: Set to true a tab is selected and all other Tabs have it set to false.
  • aria-controls: Set to the id of its associated TabPanel.

TabPanels​

Group of TabPanel components.

TabPanel​

A component that shows only the component corresponding to the selected tabId.

ARIA roles:

  • role="tabpanel"
  • aria-labelledby: Set to the id of the Tab that labels the TabPanel

Example​

Live Editor
Result
Loading...

Icon​

You can set the Icon of Tab.

Label with Icon(column)​

Default of IconDirection is 'column'.

Live Editor
Result
Loading...

Label with Icon(row)​

Live Editor
Result
Loading...

Only Icon​

Live Editor
Result
Loading...

Disabled​

You can make a tab disabled, then be not clickable.

Live Editor
Result
Loading...

Hidden​

You can make a hidden tab.

Live Editor
Result
Loading...

DefaultTab​

You can set defaultTab. Just use defaultIndex of Tab.

Live Editor
Result
Loading...

Controlled Tabs​

Like form inputs, a tab's state can be controlled.
Make sure to include an onChange as well, or else the tabs will not be interactive.

Live Editor
Result
Loading...