Skip to content

Docs: split the sidebar into sections with a page filter - #43133

Draft
julien-deramond wants to merge 4 commits into
mainfrom
v6-jd-docs-sidebar-universes
Draft

julien-deramond wants to merge 4 commits into
mainfrom
v6-jd-docs-sidebar-universes

Conversation

@julien-deramond

@julien-deramond julien-deramond commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

/cc @mdo This is a prototype to suggest an improvement for our sidebar. I'd like to have your opinion :)

-> Live preview quick access


The docs sidebar lists all 140 pages in one column, from Install down to the last utility. On a utility page, the current link sits under a hundred other entries, so the sidebar scrolls there on load and the rest of the docs is out of sight. Reaching another part of the docs means scrolling back up through everything, or knowing the page's name for the search.

This PR splits the sidebar into the seven sections sidebar.yml already defines with its section field: Getting started, Guides, Base, Forms, Components, Helpers and Utilities. The sections stay at the top of the sidebar, and only the pages of the current section are listed below them. Clicking a section opens its first page. A filter field between the sections and the pages narrows the list as you type.

375px, drawer open

Before After
Before at 375px, the drawer opens on a long list scrolled to Margin, with no way to see the other parts of the docs After at 375px, the seven sections in a two-column grid, the filter, then the Utilities pages with Margin highlighted

768px, drawer open

Before After
Before at 768px, the drawer shows the middle of the full list After at 768px, the sections in a four-column grid above the filter and the Utilities pages

1024px

Before After
Before at 1024px, the sidebar is scrolled to Margin, deep in the Utilities group After at 1024px, the sections listed at the top, Utilities selected, the filter, then the Utilities pages

1440px

Before After
Before at 1440px, the sidebar is scrolled to Margin, deep in the Utilities group After at 1440px, the sections listed at the top, Utilities selected, the filter, then the Utilities pages

All the screenshots are of the Margin page in light mode. The filter in use, with "border" typed under Utilities:

375px 1440px
After at 375px, "border" in the filter leaves the Borders group with Border, Border color, Border radius and Divide After at 1440px, "border" in the filter leaves the Borders group with Border, Border color, Border radius and Divide

A section of the sidebar holds between seven and 48 pages instead of 140, so the current page is usually visible without scrolling. The other sections are one click away at any time, on every page. Moving between sections is a page load, the same as following any other link. The page itself decides which section is open, so a shared link or a reload shows the same sidebar.

The filter matches page names and group names, without regard to case or accents. Typing "spacing" under Utilities keeps the whole Spacing group (Margin, Padding and Space), even though no page has that word in its name. Enter opens the first match, the down arrow moves into the results and Escape clears the field. It only searches the current section, and the docs search still covers the whole site.

On large screens, the sections and the filter stay pinned at the top of the sidebar while the pages scroll under them, with a short fade at the edge. In the drawer below 1024px, the sections become a compact grid (two columns on a phone, four on a tablet) so the pages keep most of the drawer's height. The header is pinned there too, because the drawer opens scrolled to the current page.

The markup lives in DocsSidebar.astro, which now groups sidebar.yml by section (the code calls each group a universe) and renders only the current one. The filter is a new sidebar-universes.js partial, about 80 lines with no dependency. The sections are plain links, so they work without JavaScript. The filter field needs it. I renamed the Getting Started section to Getting started to match the sidebar's sentence case. Nothing else read that field before.

One limit: a section opens on the first page sidebar.yml lists for it, so Base opens on Breakpoints and Utilities on the utility API. If another first page reads better, reordering sidebar.yml is enough.

The deploy preview shows it on any docs page, for example https://deploy-preview-43133--twbs-bootstrap.netlify.app/docs/6.0/utilities/margin/


TODO if moving forward with the prototype:

  • Double-check all aspects of a11y
  • Double-check the rendering and behavior at all breakpoints

🤖 Generated with Claude Code

julien-deramond and others added 4 commits October 20, 2026 20:55
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@julien-deramond
julien-deramond requested a review from a team as a code owner October 20, 2026 19:00
@julien-deramond julien-deramond added the docs Documentation site and its content label Oct 20, 2026
@julien-deramond
julien-deramond requested a review from a team as a code owner October 20, 2026 19:00
@julien-deramond julien-deramond added the v6 v6, the main branch label Oct 20, 2026
@github-project-automation github-project-automation Bot moved this to Inbox in v6.0.0 Oct 20, 2026
@julien-deramond

Copy link
Copy Markdown
Member Author

We could even think about having a max-height for the sidebar universe items to avoid having too many elements displayed at the same time on large breakpoints.

@julien-deramond
julien-deramond marked this pull request as draft October 20, 2026 19:04
@julien-deramond julien-deramond added css Sass sources or compiled CSS html Component markup: elements, attributes, structure js JavaScript or TypeScript sources and plugins needs-decision A maintainer decides first: scope, design or breaking change labels Oct 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

css Sass sources or compiled CSS docs Documentation site and its content html Component markup: elements, attributes, structure js JavaScript or TypeScript sources and plugins needs-decision A maintainer decides first: scope, design or breaking change v6 v6, the main branch

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

1 participant