Skip to content

Tabs

Free

A row of tabs that switch the panel under them, such as Overview, Activity, and Settings. A sliding mark shows the open tab.

  • Base UI
  • React 19
  • Tailwind CSS 4

Added Nov 8, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Compose the list and the panels.

project-tabs.tsx

Tabs

<div>
PropTypeDefaultDescription
classNamestring—
From Base UITabs.RootBase UI docs
valueany—The value of the currently active Tab. Use when the component is controlled. When the value is null, no Tab will be active.
defaultValueany0The default value. Use when the component is not controlled. When the value is null, no Tab will be active.
orientation"horizontal""vertical"'horizontal'The component orientation (layout flow direction).
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

TabsList

<div>
PropTypeDefaultDescription
rounded"default""full""default"
size"default""lg""sm""default"
variant"default""folder""line""default"
classNamestring—
From Base UITabs.ListBase UI docs
activateOnFocusbooleantrueWhether 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.
loopFocusbooleantrueWhether to loop keyboard focus back to the first item when the end of the list is reached while using the arrow keys.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

TabsTrigger

<button>
PropTypeDefaultDescription
classNamestring—
From Base UITabs.TabBase UI docs
valueRequiredany—The value of the Tab.
disabledboolean—Whether 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.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

TabsContent

<div>
PropTypeDefaultDescription
classNamestring—
gap"default""none""default"The space between the list and the panel: default (12px) or none, for a panel that sits flush under a list in a head with its own edge (the JSX Preview stage).
From Base UITabs.PanelBase UI docs
valueRequiredany—The value of the TabPanel. It will be shown when the Tab with the corresponding value is active.
keepMountedbooleanfalseWhether to keep the HTML element in the DOM while the panel is hidden.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.
  • Use it to switch views of one thing.
  • Use variant="line" at the top of a page.
  • Use orientation="vertical" for a settings page.
  • To set one value with no panels, use a Segmented Control.
  • To keep each heading in the flow, use an accordion.
Left ArroworRight ArrowMoves to the tab before or after. Up and Down do it when vertical.
HomeorEndGoes to the first or the last tab.
TabMoves to the panel.

The list has the tablist role. Give it an aria-label when no heading names it.

A disabled tab is skipped by the arrow keys.

Each tab keeps a 44px touch target.

Indicator
panel · the indicator slides to the active tab
Panel
fade · the panels fade in one place
  1. AddedTabs.
Open the release