Back to components
ElementTabsFree

Tabs React component

An accessible tab set with underline, pill and segmented variants, a sliding animated indicator, icons, counts, arrow-key navigation and animated content panels.

About the Tabs component

Tabs switches between related views that share one spot on the page. It comes in three looks: underline, a line that slides under the active tab, pill, a soft colored pill behind it, and segmented, a raised thumb on a shaded track like an iOS control. Each tab can have an icon and a count, and the active panel fades in when the tab changes.

items takes objects with value, label and optional icon, count, disabled and content. value or defaultValue with onValueChange set the active tab, starting on the first enabled one. variant picks the look, size sm, md or lg, accentColor the underline and pill color, and fullWidth spreads the tabs evenly across the container; otherwise a long row scrolls sideways. It follows the tabs pattern, with the arrow keys, Home and End moving between tabs.

When to use it

Use Tabs to switch between related views that share the same place on the page, like Overview, Settings and Billing, or code samples for different frameworks. The underline, pill and segmented variants cover everything from page-level navigation to compact toggles inside a card.

If people need to compare the sections side by side, show them stacked instead; tabs hide everything except the active panel.

Installation

Add the Tabs component to your project with the shadcn CLI. It lands in components/tabs.tsx as plain React + Tailwind CSS source you own and can edit.

Install
Copied!
npx shadcn@latest add @reactframe/tabs

Or copy the source by hand and install its dependencies:

Install
Copied!
npm install motion clsx tailwind-merge

Related components

SEO-ready
Breadcrumb
Free
Skeleton
Free
Pagination
Free
Tooltip
Free
Stepper
Free
Tag
Free