Navigation Bar and Sidebar Configuration
A well-structured navigation system is crucial for documentation sites. Rspress provides flexible configuration options for both the top navigation bar and sidebar, helping users navigate your content efficiently.
Navigation Bar Configuration
Basic Navigation Bar
Configure the navigation bar in rspress.config.ts:
Dropdown Menu
Create dropdown menus for grouped navigation items:
Multi-level Dropdown
Create nested dropdown structures:
External Links
Add external links with automatic icon indicators:
Active State
Navigation items automatically highlight based on current route:
Sidebar Configuration
Basic Sidebar
Configure sidebar for specific route paths:
Grouped Sidebar Items
Organize sidebar items into collapsible groups:
Collapsible Groups
Control group collapse behavior:
Multiple Sidebars
Define different sidebars for different sections:
Social Links
Add social media and community links to the navigation:
Custom Icons
Use custom SVG icons for social links:
Logo Configuration
Basic Logo
Set your site logo:
Logo with Dark Mode Support
Provide different logos for light and dark themes:
Logo with Link
Make the logo clickable:
Advanced Navigation Features
Version Selector
Add version selection dropdown:
Search Integration
Rspress includes built-in search that integrates with navigation:
Custom Navigation Order
Control the order of navigation elements:
Responsive Behavior
Mobile Navigation
Navigation automatically adapts for mobile devices:
- Hamburger menu on small screens
- Sidebar slides in from left
- Touch-friendly interactions
Hide Navigation Elements
Hide specific elements on mobile:
Localized Navigation
Per-language Navigation
Configure different navigation for each language:
Practical Examples
Example 1: Documentation Site
Example 2: Component Library Docs
Best Practices
Navigation Structure
- Keep Top-Level Items Limited: 5-7 main navigation items maximum
- Use Meaningful Labels: Clear, concise text that describes content
- Logical Grouping: Group related items together
- Consistent Naming: Use consistent terminology throughout
Sidebar Organization
- Progressive Disclosure: Start simple, reveal complexity gradually
- Group by Topic: Not by file type or technical structure
- Limit Depth: 2-3 levels maximum
- Consistent Order: Follow learning progression or logical sequence
Active States
Test that active states work correctly:
Next Steps
- Learn about Automatic Navigation Generation
- Explore MDX & React Components
- Read about Internationalization for multi-language navigation
::: tip Design Tips
- Use icons sparingly in navigation text
- Ensure sufficient contrast for accessibility
- Test navigation on mobile devices
- Keep labels short (1-3 words ideal) :::
::: warning Common Mistakes
- Don't create too many nested dropdown levels
- Avoid duplicate links in navigation and sidebar
- Don't hide important pages deep in navigation
- Remember to update navigation when adding new pages :::