vitepress
vitepress copied to clipboard
[Feature Proposal] Expand only active sidebar group
Is your feature request related to a problem? Please describe.
I've added an app level enhancement to my docs site which ensures only the active sidebar group is open when navigating through the site:
- https://spectre-org.github.io/spectre-docs/docs/get-started/
The iles framework has the same functionality.
It's pretty nice when you have long sections that would cause the menu to get overly-long and start scrolling.
Describe the solution you'd like
If you click a sidebar group header, or navigate to a page, the active sidebar group would open, and the others would close.
If you click a sidebar group toggle, the group would open / close, without affecting other groups.
The developer would opt-in to this functionality in themeConfig.sidebar
.
Describe alternatives you've considered
I've used enhanceApp()
, a router handler, and some custom code to achieve this on my own site.
Additional context
Happy to look at PRing this.
It seems that the sidebar
composable is the place to start digging around.
Validations
- [X] Follow our Code of Conduct
- [X] Read the docs.
- [X] Read the Contributing Guidelines.
- [X] Check that there isn't already an issue that asks for the same feature to avoid creating a duplicate.