Tabs
Tabs with a gliding indicator and panels that slide in the direction you travelled.
- Category: Navigation
- Licence: Free, MIT
- Built with: React 19, Tailwind CSS 4, Motion
- Dependencies: motion, clsx, tailwind-merge
Examples
Pill
Underline
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Controlled value. |
defaultValue | string | — | Initial value when uncontrolled. |
onValueChange | (value: string) => void | — | |
variant | "pill" | "underline" | "pill" | |
children | TabsList, TabsTrigger, TabsContent | — |
About Tabs
Tabs switches between views with an indicator that glides to the active tab and panels that slide in from the direction you moved, so people always know where they went. Pill and underline styles cover app and marketing use.
Tabs is a navigation component for React 19, styled with Tailwind CSS 4 and animated with Motion. It drops into Next.js, Vite, Remix or Astro through the shadcn CLI as a single file you own.
When to use Tabs
- Settings pages split into sections.
- Product pages with specs, reviews and shipping.
- Dashboards with overview and detail views.
- Code examples with preview and source.
How it works
It follows the tabs pattern with roving focus: arrow keys move between tabs, Home and End jump, and each panel is linked with aria-controls. The indicator is a shared layout element, and panel direction comes from the index change.
Links and buttons keep their roles, arrow keys move where a group is expected, the current item is marked with aria-current, and focus is always visible. With prefers-reduced-motion on, it holds still or settles instantly instead of animating.
Customizing Tabs
Every prop is documented in the API reference above with its type and default. The ones you will reach for first are listed here.
The Customize panel next to the preview lets you change variant live, and the Code tab updates to match, so the snippet you copy already carries your values.
- value (string): Controlled value.
- defaultValue (string): Initial value when uncontrolled.
- variant ("pill" | "underline", default "pill").
2 examples on this page
- Pill.
- Underline.
Goes well with Tabs
These navigation pieces share its tokens and motion language, so they sit together on one page without clashing.
- Breadcrumb: An animated React breadcrumb that folds long trails and unfolds them on click
- Pagination: Animated React pagination with smart gaps and a pill that glides to the current page
- Sidebar: A collapsible React app sidebar with spring width, fading labels and an active marker
- Steps: Animated React steps for multi-step flows: filling connectors and drawn checks
- Dropdown Menu: An animated React dropdown menu with icons, shortcuts, checkboxes and keyboard control
Install Tabs
npx shadcn@latest add https://charcoalui.com/r/tabs.jsonTabs is free and MIT licensed. The command copies tabs.tsx into components/ui and installs clsx, tailwind-merge; you can also copy the source from the Code tab by hand.
It pairs well with Gooey, a Pro piece: Liquid UI: pieces that touch melt into one another and stretch apart like goo, while text and icons stay perfectly crisp. An SVG filter plus springs, so it works with any markup.
Frequently asked questions
- How do I install Tabs?
- Run npx shadcn@latest add https://charcoalui.com/r/tabs.json. The shadcn CLI copies tabs.tsx into components/ui and installs motion, clsx, tailwind-merge. You can also copy the source from this page by hand.
- Is Tabs free for commercial use?
- Yes. Tabs is MIT licensed: use it in any personal or commercial project and change it however you like.
- Does Tabs work with Next.js?
- Yes. It is a client component for React 19 styled with Tailwind CSS 4, so it works in the Next.js App Router and Pages Router, Vite, Remix and Astro.
- Can an AI coding agent install Tabs?
- Yes. Connect the Charcoal UI MCP server (https://charcoalui.com/mcp) to Claude Code, Cursor or any MCP client; get_component returns Tabs's props and source and get_install_command returns the exact command.