Navigation and sidebar

View source

Configure the navbar, automatic filesystem navigation, and explicit sidebar trees.

Layout

The default layout is the sidebar layout:

typescript
export default {
  navigation: {
    layout: "sidebar",
    navbar: [
      { title: "Home", href: "/" },
      { title: "API", href: "/api" },
    ],
    sidebar: {
      nav: "auto",
      header: true,
      footer: false,
      headerSubtitle: "Developer Documentation",
      footerText: "Project Docs",
    },
  },
};

Set layout: "top" to place navigation above the content without the desktop sidebar.

Collapsed sidebar

On desktop the sidebar can collapse to an icon rail. Hovering or focusing a group's icon then opens a menu next to the rail with the group's page and its child pages, including nested groups as submenus, built from the same navigation data as the expanded sidebar. The current page is highlighted. Use the arrow keys to move through the menu, Enter to open a page, and Escape to close it and return to the icon. The mobile sidebar always shows the full tree and does not use the menu.

Automatic sidebar

The default navigation.sidebar.nav: "auto" mode is filesystem-based. Directories become categories, pages are ordered by frontmatter, and an index.mdx file acts as the category overview. Page metadata can add icons and badges:

text
---
title: Installation
order: 1
categoryOrder: 1
icon: package
badge: New
addedAt: 2026-09-05
toc: true
prev: /getting-started
next: /configuration
---

Set addedAt to the page's publication date in YYYY-MM-DD format. The default theme uses this metadata to mark recent pages with a small indicator in the sidebar, making newly added documentation easier to spot.

The frontmatter fields in the example are:

  • title: The page title shown in headings, navigation, and the document title.
  • order: The page order within its directory or category.
  • categoryOrder (optional): The category order when the page belongs to a directory.
  • icon (optional): The Lucide icon name shown beside the page in the sidebar.
  • badge (optional): A short label displayed with the page in navigation.
  • addedAt (optional): The publication date used for the recent-page indicator.
  • toc (optional): Enables the page's “On this page” table of contents when set to true.
  • prev (optional): The route of the previous page in the documentation flow.
  • next (optional): The route of the next page in the documentation flow.

Explicit sidebar

Use an explicit tree when the displayed order or grouping should differ from the filesystem:

typescript
export default {
  navigation: {
    sidebar: {
      nav: [
        { title: "Getting Started", href: "/getting-started" },
        {
          title: "Themes",
          items: [
            { title: "Colors", href: "/themes/colors" },
          ],
        },
      ],
    },
  },
};

Every href must point to an existing internal documentation route. Invalid or external sidebar links fail the build with a clear configuration error. Omit navigation.sidebar.nav, or set it to "auto", to return to filesystem navigation.

The default theme can render an optional promotional card below the desktop “On this page” table of contents. It is disabled unless navigation.sidebar.promo is configured:

typescript
export default {
  navigation: {
    sidebar: {
      promo: {
        title: "Build better interfaces",
        description: "Explore the tools and components for your next project.",
        href: "https://example.com",
        cta: "Learn more",
      },
    },
  },
};

The fields are:

  • title: The card heading.
  • description: The short supporting message.
  • href: The destination opened by the card action.
  • cta (optional): The action label. It defaults to Learn more.

Remove the promo object to hide the card completely. The card is only shown on desktop pages that have an “On this page” table of contents.

typescript
export default {
  navigation: {
    navbar: [
      { title: "Home", href: "/" },
      { title: "API", href: "/api" },
      { title: "Source", href: "https://github.com/example/project", external: true },
    ],
  },
};

Links that point to another origin open in a new tab with target="_blank" and rel="noopener noreferrer". A link is external when its href is an absolute http: or https: URL, or a protocol-relative //host URL, on an origin other than the site's own. Relative paths, #hash links, same-origin absolute URLs and other schemes such as mailto: or tel: keep opening in the same tab and use client-side navigation. Links that open a new tab also carry visually hidden text, (opens in a new tab), for assistive technology; it comes from the navigation.opensInNewTab site translation.

The rule applies to the navbar and its mobile menu, the logo link, the previous and next page links, Markdown links and raw <a href> elements in MDX content. Sidebar entries are always internal documentation routes.

  • The site's own origin is the origin of siteUrl. Without siteUrl, the browser's current origin is used, and server-rendered markup treats every absolute http(s) URL as external until the page hydrates. Set siteUrl so absolute links to your own site stay in the same tab from the first render.
  • An explicit external on a navbar item wins over the rule: external: true opens even a relative path in a new tab, and external: false keeps an absolute URL in the same tab.
  • A raw <a> in MDX that already sets target is left unchanged. Raw anchors do not get the hidden text, so describe them in the link text.