Understanding Tabs
Tabs are top-level navigation contexts. When you click a tab, the entire sidebar switches to show that tabβs content. Tabs are perfect for organizing major documentation sections.
What are Tabs?
A tab is a promoted group that appears at the top of the sidebar:
[Learn] [Getting Started] [API Reference] [Guides] <- Tabs
βββ Group 1
βββ Group 2
βββ Group 3
Clicking a tab switches which groups appear below.
Tabs vs. Groups
| Aspect | Groups | Tabs |
|---|---|---|
| Location | Appear as sidebar sections | Appear at top as clickable buttons |
| Navigation | Expand/collapse | Complete sidebar switch |
| Hierarchy | Organized within each other | Top-level only |
| Use Case | Organize entries | Separate major sections |
Creating Tabs
To make a group a tab, add tab: true:
{
id: "api",
label: "API Reference",
icon: "π",
tab: true, // <- Makes this a tab
groups: [
{
id: "endpoints",
label: "Endpoints",
autoGenerated: true,
},
{
id: "authentication",
label: "Authentication",
entries: [
{ slug: "api/auth/oauth" },
{ slug: "api/auth/jwt" },
],
},
],
}
Sidebar renders as:
[Learn] [API Reference] <- Now it's a tab!
When "API Reference" tab is active:
βββ Endpoints
βββ Authentication
βββ OAuth
βββ JWT
The Default Tab
Non-tabbed groups appear in a special βdefaultβ tab. Configure it in the defaultTab property:
export const SIDEBAR_NAVIGATION = {
"my-docs": {
defaultTab: {
label: "Learn", // Label for the default tab
icon: "π", // Icon for the default tab
},
groups: [
// Non-tabbed groups appear in the default tab
{
id: "getting-started",
label: "Getting Started",
// No tab: true, so appears in default tab
},
// This one becomes a separate tab
{
id: "api",
label: "API Reference",
tab: true,
},
],
},
};
Sidebar renders as:
[Learn] [API Reference] <- Two tabs
β
When "Learn" tab is active:
βββ Getting Started
βββ Introduction
βββ Installation
βββ Quick Start
When "API Reference" tab is active:
βββ Endpoints
βββ Authentication
βββ Rate Limiting
Multiple Tabs
You can have multiple tabs. They appear left-to-right in order:
groups: [
{
id: "guides",
label: "Guides",
tab: true,
autoGenerated: true,
},
{
id: "api",
label: "API Reference",
tab: true,
autoGenerated: true,
},
{
id: "patterns",
label: "Common Patterns",
tab: true,
autoGenerated: true,
},
];
Sidebar renders as:
[Guides] [API Reference] [Common Patterns]
β First tab β Second tab β Third tab
Tabs with Nested Groups
Tabs can contain complex hierarchies with nested groups:
{
id: "documentation",
label: "Documentation",
icon: "π",
tab: true,
groups: [
{
id: "getting-started",
label: "Getting Started",
entries: [
{ slug: "documentation/getting-started/installation" },
{ slug: "documentation/getting-started/quick-start" },
],
},
{
id: "advanced",
label: "Advanced Topics",
groups: [
{
id: "architecture",
label: "Architecture",
autoGenerated: true,
},
{
id: "performance",
label: "Performance Tuning",
autoGenerated: true,
},
],
},
],
}
Sidebar when βDocumentationβ tab is active:
π Documentation
βββ Getting Started
β βββ Installation
β βββ Quick Start
βββ Advanced Topics
βββ Architecture
βββ Performance Tuning
Real-World Example: This Site
This site showcases tabs with nested groups:
Navigation System (Tab)
βββ Core Concepts
β βββ Entries
β βββ Groups
β βββ Nested Groups
β βββ Tabs <- You're reading this!
βββ Hierarchy
Configuration (Tab)
βββ Basics
βββ Advanced
βββ Nested Setup
βββ Tab Management
Generation Strategies (Tab)
βββ Auto-Generation
βββ Manual Creation
βββ Hybrid Approach
Each major section is a tab. When you click a tab, the sidebar switches to show its content.
When to Use Tabs
β Multiple major sections: Documentation vs. API reference β Different audiences: User guides vs. Developer guides β Product versions: v1 vs. v2 vs. v3 β Multiple collections worth highlighting
Tab Limitations
- Tabs are only top-level (you canβt nest tabs within tabs)
- Too many tabs (5+) clutters the interface
- Not recommended for simple documentation
Next Steps
Learn about: