Tabs

Loading...

Installation

Install the component via the CLI in one command.

npx shadcn@latest add @intentui/tabs

Manual installation

Use this approach if you prefer to install and wire up the component yourself instead of using the CLI.

npm install react-aria-components tailwind-merge

Anatomy

import { Tab, TabList, TabPanel, Tabs } from "@/components/ui/tabs"
<Tabs aria-label="Recipe App">
  <TabList>
    <Tab id="i">Ingredients</Tab>
    <Tab id="m">Meal Plans</Tab>
  </TabList>
  <TabPanel id="i">
    Check the list of ingredients needed for your chosen recipes.
  </TabPanel>
  <TabPanel id="m">
    Discover curated meal plans to simplify your weekly cooking.
  </TabPanel>
</Tabs>

Examples

With icons

If you want to include icons in your tabs, it's simple to do. This tab setup handles icons smoothly, maintaining a clean design.

Loading...

Orientation

You can set the orientation of the tabs to either horizontal or vertical.

Loading...

Tabs can also be used as navigational links. Add the href prop to a Tab to render it as a link and navigate to the provided URL when selected.

When using a framework-specific link component, integrate it through your client-side routing setup. Learn more in Client Side Routing.

Adding href also applies the pointer cursor automatically, making the tab behave like an interactive navigation item.

Loading...

Disabled

You can disable all tabs by setting the isDisabled prop to true.

Loading...

You can also disable individual tabs by setting the isDisabled prop for each one, like this:

<Tab isDisabled id="c">Contact</Tab>
<Tab isDisabled id="a">About Us</Tab>

Component API

Tab

Tab extends the React Aria Components <Tab> component.

classNamestring

TabList

TabList extends the React Aria Components <TabList> component.

classNamestring

TabPanel

TabPanel extends the React Aria Components <TabPanel> component.

classNamestring

TabPanels

TabPanels extends the React Aria Components <TabPanels> component.

classNamestring

Tabs

Tabs extends the React Aria Components <Tabs> component.

classNamestring

TabScrollArea

TabScrollArea extends the native <div> element.

classNamestring

See the React Aria for the full API reference.

Design