Jone

Tabs

A high-quality, unstyled React tabs component for toggling between related panels on the same page.

A component for toggling between related panels on the same page.

Anatomy

Import the component and assemble its parts:

Anatomy
import { Tabs } from '@base-ui/react/tabs';

<Tabs.Root>
  <Tabs.List>
    <Tabs.Tab />
    <Tabs.Indicator />
  </Tabs.List>
  <Tabs.Panel />
</Tabs.Root>;

API reference

Root

NameTypeDefaultDescription
valueOptionalTabsTab.Value | undefinedThe value of the currently active `Tab`. Use when the component is controlled. When the value is `null`, no Tab will be active.
defaultValueOptionalTabsTab.Value | undefined0The default value. Use when the component is not controlled. When the value is `null`, no Tab will be active.
orientationOptionalTabsRoot.Orientation | undefinedhorizontalThe component orientation (layout flow direction).

List

NameTypeDefaultDescription
activateOnFocusOptionalboolean | undefinedfalseWhether to automatically change the active tab on arrow key focus. Otherwise, tabs will be activated using <kbd>Enter</kbd> or <kbd>Space</kbd> key press.
loopFocusOptionalboolean | undefinedtrueWhether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys.

Tab

NameTypeDefaultDescription
valueRequiredTabsTab.ValueThe value of the Tab.
disabledOptionalboolean | undefinedWhether the Tab is disabled. If a first Tab on a `<Tabs.List>` is disabled, it won't initially be selected. Instead, the next enabled Tab will be selected. However, it does not work like this during server-side rendering, as it is not known during pre-rendering which Tabs are disabled. To work around it, ensure that `defaultValue` or `value` on `<Tabs.Root>` is set to an enabled Tab's value.

Indicator

NameTypeDefaultDescription
renderBeforeHydrationOptionalboolean | undefinedfalseWhether to render itself before React hydrates. This minimizes the time that the indicator isn't visible after server-side rendering.

Panel

NameTypeDefaultDescription
valueRequiredTabsTab.ValueThe value of the TabPanel. It will be shown when the Tab with the corresponding value is active.
keepMountedOptionalboolean | undefinedfalseWhether to keep the HTML element in the DOM while the panel is hidden.

On this page