shadcn.io is not affiliated with official shadcn/ui
Tabs examples · Advanced
Nested Tabs for React
Profile, Settings and Billing tabs, each with its own row of tabs inside the panel.
One row of tabs is not enough when every section has subsections. Each outer panel renders a second Tabs with its own triggers and default, so Profile, Settings and Billing each switch between three views. Use it for account pages where the top level picks a section and the second picks a detail.
Preview
Installation
FAQ
How is the outer tab set up?
Tabs starts on profile and is w-full max-w-2xl. The triggers are Profile, Settings and Billing, built from a sections array, and each panel is a bordered block headed by the section name.
Where do the second tabs come from?
Each outer panel renders its own Tabs from the section's tabs. Profile starts on Personal Info, Settings on General and Billing on Current Plan.
Does the inner tab stay put when I leave the outer tab?
No. Inactive panels unmount, so the inner tabs mount again at their default when you come back.
Set keepMounted on each TabsContent to keep the inner tabs mounted.
What is inside an inner panel?
A bordered box of rows, each a font-medium label over muted text. Personal Info shows Full Name, Email and Location.
Related
- Basic TabsFour horizontal tabs that switch between
- Tabs with Badge CountsMailbox tabs with a badge after each
- Controlled TabsThree step tabs held in state, with
- Multi-Level Nested AccordionAn accordion of help center topics where
- Tabs with CardsFeatured, Popular and Recent tabs, each
- Tabs with FormsLogin and Register tabs that each hold a