Skip to content

[Feature]: Accordion mode for sidebar (single section expanded at a time) #2989

@kubijo

Description

@kubijo

What problem does this feature solve?

It would be useful to have an option for accordion-style sidebar behavior where expanding one section automatically collapses others.

For documentation sites with many sidebar sections (e.g., multiple products or large changelogs), the sidebar can become very long when multiple sections are expanded. Accordion mode would keep the sidebar compact and focused.

What does the proposed API look like?

  // In rspress.config.ts
  themeConfig: {
    sidebar: {
      accordion: true, // Only one section expanded at a time
    }
  }

…or per-path:

  sidebar: {
    '/docs/': {
      accordion: true,
      items: [...]
    }
  }

Alternatives considered:

  • CSS/JS manipulation in custom theme - doesn't persist because Rspress manages sidebar state internally
  • Always starting sections collapsed (collapsed: true) - requires manual expand each time, poor UX

Prior art:

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions