Xzero UI
Pro library

Docs sidebarPro

A docs layout with a live filtering nav tree, version switcher, and a gliding on this page outline.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/docs-sidebar
Live · keyboard ready

Variant: Docs

A docs layout with a live filtering nav tree, version switcher, and a gliding on this page outline.

Use this for product or API documentation. Load the tree and pages from your content source, route page changes through your router, and point the version switcher at your versioned builds.

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/docs-sidebar

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { DocsSidebar } from "@/components/xzero/blocks/docs-sidebar/docs-sidebar";

export default function DocsPage() {
  return (
    <DocsSidebar
      defaultCollapsed={false}
      onCollapsedChange={(collapsed) => localStorage.setItem("docs-rail", String(collapsed))}
    />
  );
}

API reference

DocsSidebar

A docs layout with a filterable nav tree, version switcher, page content with code blocks, and an on this page outline that tracks scroll. The tree, pages, and versions are sample content.

PropTypeDefaultDescription
defaultCollapsedbooleanfalseStart with the navigation collapsed to its icon rail.
onCollapsedChange(collapsed: boolean) => void–Called when the navigation collapses or expands, from the toggle or the [ shortcut.

Keyboard interactions

KeysAction
[Toggles the icon rail when focus is not in a text field, menu, or dialog.
Arrow Up / Down, Home / EndMove through the nav tree.
Arrow Left / RightCollapse or expand a nav group.
EnterIn the filter field, opens the first matching page.
EscapeClears the filter.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Related

Guidance for AI tools

Blocks are complete, self-contained screens with sample data. Replace the sample data and connect the callbacks described above. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components