Documentation sidebar navigation with grouped links and active state
Docs Sidebar Component
A sidebar navigation component for documentation sites. Renders grouped links (e.g. Introduction, Foundations, Components) with active-state styling. Used in the docs layout with a toggle and overlay on mobile.
Add this component
Run the command below in your project directory. When prompted, select the component(s) you want. The CLI will copy the CSS and component files.
Choose your package manager â click a tab to select, then copy the command.
npm pnpm yarn bun
bashbash
npx rizzo-css add
bashbash
pnpm dlx rizzo-css add
bashbash
npx rizzo-css add
bashbash
bunx rizzo-css add
Live example
The sidebar on the left of this page is the Docs Sidebar. Below is a compact demo with the same nav data and placeholder main content.
Page title
This is the main content area. The sidebar links to Introduction, Foundations, and Components. Use the same layout in your docs: docs-sidebar + a main container with your page content.
On mobile, the sidebar typically collapses behind a toggle; the main area fills the viewport.
Usage
Pass currentPath (current URL pathname) and framework (or path prefix) so links and active state match the docs framework (Astro, Svelte, React, Vue, Vanilla). The sidebar uses DOCS_NAV from config; you can provide a custom nav structure via a prop if you extend the component.
Usage
Full example for each framework (Astro, Vanilla, Svelte, Vue, React). Switch framework via View as or by clicking a Usage tabâboth stay in sync.
<!-- Layout: sidebar + main. BEM: docs-sidebar, docs-sidebar__nav, docs-sidebar__group, docs-sidebar__group-label (small heading), docs-sidebar__list, docs-sidebar__item, docs-sidebar__link, docs-sidebar__link--active. See /docs/vanilla/components/docs-sidebar for full HTML with correct hrefs. -->
import { DocsSidebar } from './components/react';
<DocsSidebar
pathPrefix="/docs/react"
currentPath={pathname}
/>
Props (Astro)
currentPath (string) â Current URL pathname (e.g. Astro.url.pathname)
framework (Framework) â { framework: { pathPrefix } } so hrefs use the correct prefix (/docs, /docs/svelte, /docs/vanilla)
BEM classes
docs-sidebar, docs-sidebar__nav, docs-sidebar__group, docs-sidebar__group-label (small uppercase heading), docs-sidebar__list, docs-sidebar__item, docs-sidebar__link, docs-sidebar__link--active. Sidebar layout and mobile behavior (toggle, overlay) are in the docs layout; see DocsLayout.astro and pages.css.