Ariadocs

The sidebar.

Docs.Nav renders the sidebar from docs.getNavigation(), openapi.getNavigation() or both. The sidebar on this site is one Docs.Nav.

Top-level groups become headings. Nested groups collapse, and the one holding the current page opens. Items with a badge show it before the title.

PropWhat it does
itemsThe sidebar data
activeHrefThe current path, to highlight the current page
baseHrefA prefix for relative links, like "/docs"
linkAsYour link component, such as Next's Link
onNavigateCalled on click, for example to close a drawer

In Next.js, pass Link and the current path from a Client Component:

"use client";

import Link from "next/link";
import { usePathname } from "next/navigation";
import { Docs } from "@ariadocs/components";
import type { NavItem } from "@ariadocs/core";

export function Sidebar({ items }: { items: NavItem[] }) {
  return <Docs.Nav items={items} activeHref={usePathname()} linkAs={Link} />;
}