Creating Tabs
Tabs are top-level navigation elements that split your documentation into separate sections. Think of tabs as completely independent view modes.
What Are Tabs?
ββββββββββββββββββββββββββββββββββββ
β Getting Started β API β Guides β <- Tabs
ββββββββββββββββββββββββββββββββββββ€
β Sidebar Content for selected tab β
β β
β Current tab: Getting Started β
ββββββββββββββββββββββββββββββββββββ
Clicking a tab switches the entire sidebar navigation.
Creating Your First Tab
Step 1: Define in Configuration
export const SIDEBAR_NAVIGATION = {
docs: {
defaultTab: {
label: "Getting Started",
icon: "π",
},
groups: [
{
id: "quickstart",
label: "Quick Start",
tab: true, // <- This makes it a tab!
autoGenerated: true,
},
{
id: "guides",
label: "How-To Guides",
tab: true, // <- Another tab
autoGenerated: true,
},
{
id: "reference",
label: "Reference",
tab: true, // <- Third tab
autoGenerated: true,
},
],
},
};
Key: Set tab: true to promote a group to a tab.
Step 2: Create Folder Structure
content/docs/
ββ quickstart/ <- Matches "quickstart" tab
β ββ intro.md
β ββ setup.md
β ββ first-app.md
ββ guides/ <- Matches "guides" tab
β ββ authentication.md
β ββ database.md
β ββ deployment.md
ββ reference/ <- Matches "reference" tab
ββ api.md
ββ cli.md
ββ config.md
Step 3: User Experience
Users see tabs:
βββββββββββββββββββββββββββββββββββ
β Quickstart β Guides β Reference β
βββββββββββββββββββββββββββββββββββ
Content below changes based on selected tab.
On Quickstart tab:
ββ Introduction
ββ Setup
ββ First App
On Guides tab:
ββ Authentication
ββ Database
ββ Deployment
On Reference tab:
ββ API
ββ CLI
ββ Config
Clicking tabs switches navigation entirely.
Tab with Nested Groups
Tabs can contain groups (creating another level of navigation):
{
id: "api",
label: "API",
tab: true,
groups: [
{
id: "authentication",
label: "Authentication",
autoGenerated: true,
},
{
id: "resources",
label: "Resources",
groups: [
{ id: "users", label: "Users", autoGenerated: true },
{ id: "posts", label: "Posts", autoGenerated: true },
{ id: "comments", label: "Comments", autoGenerated: true },
],
},
{
id: "errors",
label: "Error Handling",
autoGenerated: true,
},
],
}
Navigation:
Tabs: [Quickstart] [API] [Reference]
When on API tab, sidebar shows:
ββ Authentication
ββ Resources
β ββ Users
β ββ Posts
β ββ Comments
ββ Error Handling
Tabs + nested groups = powerful organization.
Tab Icons
Icons help users identify tabs quickly:
defaultTab: {
label: "Getting Started",
icon: "π", // <- Rocket for quick start
},
groups: [
{
id: "getting-started",
label: "Getting Started",
tab: true,
icon: "π", // <- Book icon
},
{
id: "api",
label: "API Reference",
tab: true,
icon: "π", // <- Link icon
},
{
id: "examples",
label: "Examples",
tab: true,
icon: "π‘", // <- Lightbulb icon
},
],
Icons appear with tab labels. Users recognize patterns:
- π Getting Started
- π API
- π‘ Examples
- βοΈ Configuration
- π οΈ Advanced
Tab Selection State
Tabs remember selection. If user navigates to:
/docs/api/endpoints
And selects βReferenceβ tab, sidebar updates but URL pattern changes:
/docs/reference/overview
Breadcrumb updates:
Before: Home > Docs > API > Endpoints
After: Home > Docs > Reference > Overview
Each tab maintains its own content and breadcrumb trail.
Common Tab Structures
Structure 1: By User Journey
Getting Started -> Learn -> Build -> Deploy -> Reference
groups: [
{ id: "getting-started", label: "Getting Started", tab: true, ... },
{ id: "learn", label: "Learn", tab: true, ... },
{ id: "build", label: "Build", tab: true, ... },
{ id: "deploy", label: "Deploy", tab: true, ... },
{ id: "reference", label: "Reference", tab: true, ... },
]
New users start with βGetting Startedβ tab. Advanced users jump to βReferenceβ tab.
Structure 2: By Audience
Users | Developers | Operators
groups: [
{ id: "users", label: "Users", tab: true, ... },
{ id: "developers", label: "Developers", tab: true, ... },
{ id: "operators", label: "Operators", tab: true, ... },
]
Each audience sees relevant content in their tab.
Structure 3: By Product
Core | Extensions | Plugins | Marketplace
groups: [
{ id: "core", label: "Core", tab: true, ... },
{ id: "extensions", label: "Extensions", tab: true, ... },
{ id: "plugins", label: "Plugins", tab: true, ... },
{ id: "marketplace", label: "Marketplace", tab: true, ... },
]
Each product/feature gets its own tab.
Structure 4: By Version
v3 (Current) | v2 (LTS) | v1 (Legacy)
groups: [
{ id: "v3-current", label: "v3 (Current)", tab: true, ... },
{ id: "v2-lts", label: "v2 (LTS)", tab: true, ... },
{ id: "v1-legacy", label: "v1 (Legacy)", tab: true, ... },
]
Users select their version, see relevant docs.
Switching Between Tabs
Manual Tab Click
User clicks βAPIβ tab -> sidebar changes -> breadcrumb updates -> URL changes.
Was viewing: /docs/guides/authentication
Clicked: API tab
Now viewing: /docs/api/overview (or defaultTab for API)
Default Tab
If user visits /docs/ (no specific page), they see:
defaultTab: { label: "Getting Started", icon: "π" }
They land on Getting Started tabβs first page.
Deep Linking
Users can share direct links to specific tabs:
/docs/api/endpoints -> Opens API tab, shows endpoints
/docs/guides/setup -> Opens Guides tab, shows setup
/docs/reference/config -> Opens Reference tab, shows config
Clicking those links automatically switches to correct tab.
Tab + Manual Control
Mix tabs with manual entries:
groups: [
{
id: "essentials",
label: "Essentials",
tab: true,
autoGenerated: false,
entries: [
{ slug: "essentials/why-choose-us" },
{ slug: "essentials/features" },
{ slug: "essentials/pricing" },
],
},
{
id: "guides",
label: "Guides",
tab: true,
autoGenerated: true, // Auto-discover all files
},
{
id: "api",
label: "API",
tab: true,
autoGenerated: false,
entries: [{ slug: "api/authentication" }, { slug: "api/endpoints" }],
},
];
Result:
- Essentials tab: 3 specific pages only
- Guides tab: all files appear automatically
- API tab: only listed endpoints appear
Performance Notes
Each tab loads sidebar content separately:
- First load: Tab 1 loads
- Click Tab 2: Tab 2βs sidebar loads (lazy)
- Click Tab 3: Tab 3βs sidebar loads (lazy)
No performance impact from multiple tabs.
Responsive Behavior
On mobile, tabs stack or become dropdowns:
Desktop (3+ tabs):
[Getting Started] [API] [Reference] [Advanced]
Tablet (2-3 tabs):
[Getting Started] [API] [Reference] [βΌ More]
Mobile (1+ tab):
Getting Started βΌ (dropdown)
Users can still access all tabs on mobile via dropdown.
Migration: Groups to Tabs
Converting existing groups to tabs:
Before (No tabs)
groups: [
{ id: "intro", label: "Introduction", autoGenerated: true },
{ id: "guides", label: "Guides", autoGenerated: true },
{ id: "reference", label: "Reference", autoGenerated: true },
];
Sidebar shows 3 groups, all in same view.
After (With tabs)
groups: [
{ id: "intro", label: "Introduction", tab: true, autoGenerated: true },
{ id: "guides", label: "Guides", tab: true, autoGenerated: true },
{ id: "reference", label: "Reference", tab: true, autoGenerated: true },
];
Same content, now organized with tabs. Just add tab: true.