Skip to main content

molecules

Design pages nav

The sidebar navigation of these design-system docs, with up to three levels of links and the current page highlighted.

Specimens

Three levels A small literal nav stands in for the eleventyNavigation entries the layout passes.
{{ DesignPages.render({
  currentUrl: "/docs/design/molecules/",
  nav: [
    {
      title: "Atoms",
      url: "/docs/design/atoms/",
      children: [{ title: "Button", url: "/docs/design/atoms/button/" }]
    },
    {
      title: "Molecules",
      url: "/docs/design/molecules/",
      children: [
        {
          title: "Stats",
          url: "/docs/design/molecules/stats/",
          children: [
            {
              title: "Stats slots",
              url: "/docs/design/molecules/stats/slots/"
            }
          ]
        }
      ]
    }
  ]
}) }}

Params

ParamTypeDescription
navarrayeleventyNavigation entries (title, url, children). Each child may carry a group label; children are expected pre-sorted. A top-level entry may carry part. The caller pre-filters.
currentUrlstringThe entry whose url matches gets aria-current="page" and the highlighted style.
homeobjectOptional { url, title }. Renders as the first link, before any part or section. The layout passes the Design root as “Introduction”.
labelstringThe <nav>'s accessible name. Defaults to “Design section navigation”; the layout passes “Design section navigation”.

Fixed design: takes no styling params. Its colours are set for the dark
docs ground (neutral-950): neutral links, neutral-800 hover, a
primary-900 current entry, and neutral-500 uppercase group labels.