Command Palette

Search for a command to run...

Docs
Nested Tabs

Nested Tabs

A tab component with nested sub-tabs that expand with smooth animations

Loading...

Installation

Usage

import NestedTabs from "@/components/ruixen/nested-tabs";
 
const tabItems = [
  {
    value: "dashboard",
    label: "Dashboard",
    content: "Main Dashboard Overview",
    subTabs: [
      { value: "stats", label: "Stats", content: "Detailed stats here." },
      { value: "reports", label: "Reports", content: "Reports content here." },
    ],
  },
  {
    value: "settings",
    label: "Settings",
    content: "General settings content",
    subTabs: [
      { value: "profile", label: "Profile", content: "Profile settings here." },
      { value: "account", label: "Account", content: "Account settings here." },
    ],
  },
];
 
export default function App() {
  return <NestedTabs items={tabItems} defaultValue="dashboard" />;
}

Props

PropTypeDefaultDescription
itemsNestedTabItem[]Default itemsArray of tab items with optional sub-tabs
defaultValuestring"dashboard"Default active tab value
classNamestring""Additional CSS classes

Types

interface NestedSubTab {
  value: string;
  label: string;
  content?: React.ReactNode;
}
 
interface NestedTabItem {
  value: string;
  label: string;
  content?: React.ReactNode;
  subTabs?: NestedSubTab[];
}