Free and open-source React tab components built for modern applications and websites. These tabs are built using React Aria and styled with Tailwind CSS.
Installation
You can add this tabs component using our CLI or manually:
npx untitledui@latest add tabs
Tabs examples
Below are examples and variations of this tabs component:
API reference
Import the parts and assemble them:
import { Tabs } from "@/components/application/tabs/tabs"; Â <Tabs> <Tabs.List> <Tabs.Item /> </Tabs.List> <Tabs.Panel /> </Tabs>
Tabs
Renders React Aria’s Tabs — all of its props are supported.
Styling (5)
Accessibility (4)
Also accepts the global HTML attributes (dir, lang, hidden, inert, translate), all standard React DOM event handlers.
Tabs.Item
Renders React Aria’s Tab — all of its props are supported.
Props from React Aria (29)
Also accepts the global HTML attributes (dir, lang, hidden, inert, translate), all standard React DOM event handlers.
Tabs.List
Renders React Aria’s TabList — all of its props are supported.
Props from React Aria Components (9)
Also accepts the global HTML attributes (dir, lang, hidden, inert, translate), all standard React DOM event handlers.
Tabs.Panel
Renders React Aria’s TabPanel — all of its props are supported.
Styling (4)
Accessibility (4)
Also accepts the global HTML attributes (dir, lang, hidden, inert, translate), all standard React DOM event handlers.
FAQs
Please refer to our frequently asked questions page for more.
Set type on Tabs.List. Horizontal tabs accept "button-brand", "button-gray", "button-border", "button-minimal" and "underline". Vertical tabs accept the same button types plus "line" in place of "underline". The default is "button-brand".
Pass orientation="vertical" to Tabs. Tabs.List reads the orientation from it and stacks the tabs in a column, so you don't need to set it twice. Use type="line" for the vertical equivalent of the underline style.
Pass selectedKey and onSelectionChange to Tabs, where the key is the id of a Tabs.Item. For an uncontrolled tab group, use defaultSelectedKey instead. Each Tabs.Panel is matched to its tab by the same id.
Set size on Tabs.List to "sm" or "md". The default is "sm". Add fullWidth to Tabs.List to stretch every tab with flex-1 so they share the available width equally.
Yes. Pass badge (a string or number) and icon (a component or element) to Tabs.Item. The badge is styled hidden md:flex, so it is not visible below the md breakpoint. The "underline", "line" and "button-brand" types render it as a pill that turns brand-colored when the tab is hovered or selected, while the other types render a gray modern badge that keeps its color in every state.
Tabs sets React Aria's keyboardActivation to "manual" by default, so the arrow keys move focus between tabs and Enter or Space selects the focused tab. Pass keyboardActivation="automatic" to Tabs if you want a tab to be selected as soon as it receives focus.
The examples on this page hide the tabs below the md breakpoint with max-md:hidden and show a NativeSelect instead, wired to the same selectedKey state. Copy that pattern if your tab list is too wide for small screens, or drop the select if your tabs fit.