xyd 0.1.0-beta - Coming Soon

Core concepts
/
Navigation

Navigation

Learn how to navigate your docs

Navigation is one of the core concepts in xyd to understand as it determines how your documentation pages are organized, navigated, and accessed by users. It provides flexible ways to structure your content.

Overview

You can customize the navigation by adding a routes in docs.json file to your project.

The navigation property controls the hierarchy of your documentation. It's grouped into multiple properties:

  • sidebar - Main navigation, usually displayed on the left side where all pages are rendered.
  • tabs - Navigate through tabs, the most in header area.
  • sidebarDropdown - Navigate through sidebar dropdown.
  • anchors - Fixed navigation, helpful for displaying a static navigation/links.
  • segments - Smaller navigational structures based on specific route.

Dividing a navigation into multiple properties helps you to organize your documentation better.

asset

The simples way to define sidebar is declaring a pages within it:

Note you do not need to append .md/.mdx or / at beginning to the file paths.

Groups

If you need more advanced structures, define sidebar as object:

Nested Groups

You can also define nested groups:

Group PageComing Soon

If you want to have a clickable group as a page, define page instead of group:

Even while the clickable group header in the sidebar is still Coming Soon, a group that declares a page (either a Group Page, or a named group with a page) already becomes a clickable breadcrumb automatically — breadcrumbs link any crumb that resolves to a real route. See breadcrumb links.

Routing

You can also do more advanced routing in the sidebar, like matching based on the specific route:

Order

Thanks to order you are able to set a custom order of docs groups. It's the most useful with auto-generatated docs - for OpenAPI/GraphQL integration for example. There are a few options how to change an order:

Tabs

Tabs

Navigation Item structure displayed in tabs-like style:

Tabs API Reference
Check the full Tabs API Reference
    array of NavigationItem
    Core interface for navigation items
      title
      string
      The navigation item title
      description
      string
      The navigation item description
      page
      string
      The navigation page, if set it redirects to the page + matches based on routing
      href
      string
      The navigation href, if set it redirects but does not match based on routing
      icon
      React.ReactNode
      The navigation item icon
      color
      string
      Accent color (any CSS color) for this item. Used by `logoTrailing` product switchers and accent-aware themes (e.g. `terrarium` ) to recolor the UI per product — the active item's `color` is applied as `--theme-color-primary` .
      dropdownMenu
      Nested navigation rendered as a dropdown menu under this item. Recursive — a child may itself declare `dropdownMenu` to create submenus (e.g. `api → [Browser SDK, REST API, GraphQL]` ). Supported on header anchors and tabs. Accepts a plain item array, or the object form DropdownMenu carrying menu-level options (e.g. `{ itemsPerColumn: 7, items: [...] }` ).
        DropdownMenu
        DropdownMenu
        Object form of NavigationItem.dropdownMenu : the menu items plus menu-level options.
          items
          array of NavigationItem
          Required
          The menu items.
          itemsPerColumn
          number
          Maximum items rendered in ONE COLUMN — overflowing items wrap into additional columns (e.g. `7` renders a 12-item menu as two columns of 7 + 5). Omit for a single column.
        NavigationItem[]
        NavigationItem[]
      float
      "center" | "right"
      Render this item on the RIGHT of the header rather than with its siblings, before the search box — for a tab that is a reference you look things up in rather than a stop in the reading order (e.g. an API reference). Honored only by the `tabs` appearance, and there only for `"right"` — the union matches WebEditorHeader , which intersects this type and already carries both values. The item keeps everything a centered tab has, including `dropdownMenu` and route-prefix active highlighting.
      pages
      array of NavigationItem
      Nested navigation items — recursive. Honored ONLY by sidebar-dropdown surfaces ( `navigation.sidebarDropdown` and `appearance: "sidebarDropdown"` segments): an entry with `pages` (typically without `page` / `href` ) renders as an inline-expandable GROUP row inside the dropdown popover — clicking it expands its children (indented) within the same popover. `title` , `icon` , and `description` apply to the group row. Other appearances (tabs, logoTrailing) ignore nesting.
      trigger
      "hover" | "click"
      How the `dropdownMenu` opens. Defaults to `"hover"` .

Sidebar Dropdown

Navigation Item structure displayed in dropdown-like style inside sidebar:

Sidebar Dropdown API Reference
Check the full Sidebar Dropdown API Reference
    array of NavigationItem
    Core interface for navigation items
      title
      string
      The navigation item title
      description
      string
      The navigation item description
      page
      string
      The navigation page, if set it redirects to the page + matches based on routing
      href
      string
      The navigation href, if set it redirects but does not match based on routing
      icon
      React.ReactNode
      The navigation item icon
      color
      string
      Accent color (any CSS color) for this item. Used by `logoTrailing` product switchers and accent-aware themes (e.g. `terrarium` ) to recolor the UI per product — the active item's `color` is applied as `--theme-color-primary` .
      dropdownMenu
      Nested navigation rendered as a dropdown menu under this item. Recursive — a child may itself declare `dropdownMenu` to create submenus (e.g. `api → [Browser SDK, REST API, GraphQL]` ). Supported on header anchors and tabs. Accepts a plain item array, or the object form DropdownMenu carrying menu-level options (e.g. `{ itemsPerColumn: 7, items: [...] }` ).
        DropdownMenu
        DropdownMenu
        Object form of NavigationItem.dropdownMenu : the menu items plus menu-level options.
          items
          array of NavigationItem
          Required
          The menu items.
          itemsPerColumn
          number
          Maximum items rendered in ONE COLUMN — overflowing items wrap into additional columns (e.g. `7` renders a 12-item menu as two columns of 7 + 5). Omit for a single column.
        NavigationItem[]
        NavigationItem[]
      float
      "center" | "right"
      Render this item on the RIGHT of the header rather than with its siblings, before the search box — for a tab that is a reference you look things up in rather than a stop in the reading order (e.g. an API reference). Honored only by the `tabs` appearance, and there only for `"right"` — the union matches WebEditorHeader , which intersects this type and already carries both values. The item keeps everything a centered tab has, including `dropdownMenu` and route-prefix active highlighting.
      pages
      array of NavigationItem
      Nested navigation items — recursive. Honored ONLY by sidebar-dropdown surfaces ( `navigation.sidebarDropdown` and `appearance: "sidebarDropdown"` segments): an entry with `pages` (typically without `page` / `href` ) renders as an inline-expandable GROUP row inside the dropdown popover — clicking it expands its children (indented) within the same popover. `title` , `icon` , and `description` apply to the group row. Other appearances (tabs, logoTrailing) ignore nesting.
      trigger
      "hover" | "click"
      How the `dropdownMenu` opens. Defaults to `"hover"` .

Anchors

asset

Anchors provide a way to add fixed navigation elements. They're useful for displaying important external links or resources.

Anchors API Reference
Check the full Anchors API Reference
    header
    array of AnchorHeader
    Header anchors
      NavigationItem
      NavigationItem
      Core interface for navigation items
        title
        string
        The navigation item title
        description
        string
        The navigation item description
        page
        string
        The navigation page, if set it redirects to the page + matches based on routing
        href
        string
        The navigation href, if set it redirects but does not match based on routing
        icon
        React.ReactNode
        The navigation item icon
        color
        string
        Accent color (any CSS color) for this item. Used by `logoTrailing` product switchers and accent-aware themes (e.g. `terrarium` ) to recolor the UI per product — the active item's `color` is applied as `--theme-color-primary` .
        dropdownMenu
        Nested navigation rendered as a dropdown menu under this item. Recursive — a child may itself declare `dropdownMenu` to create submenus (e.g. `api → [Browser SDK, REST API, GraphQL]` ). Supported on header anchors and tabs. Accepts a plain item array, or the object form DropdownMenu carrying menu-level options (e.g. `{ itemsPerColumn: 7, items: [...] }` ).
          DropdownMenu
          DropdownMenu
          Object form of NavigationItem.dropdownMenu : the menu items plus menu-level options.
            items
            array of NavigationItem
            Required
            Core interface for navigation items
              title
              string
              The navigation item title
              description
              string
              The navigation item description
              page
              string
              The navigation page, if set it redirects to the page + matches based on routing
              href
              string
              The navigation href, if set it redirects but does not match based on routing
              icon
              React.ReactNode
              The navigation item icon
              color
              string
              Accent color (any CSS color) for this item. Used by `logoTrailing` product switchers and accent-aware themes (e.g. `terrarium` ) to recolor the UI per product — the active item's `color` is applied as `--theme-color-primary` .
              dropdownMenu
              Nested navigation rendered as a dropdown menu under this item. Recursive — a child may itself declare `dropdownMenu` to create submenus (e.g. `api → [Browser SDK, REST API, GraphQL]` ). Supported on header anchors and tabs. Accepts a plain item array, or the object form DropdownMenu carrying menu-level options (e.g. `{ itemsPerColumn: 7, items: [...] }` ).
                DropdownMenu
                DropdownMenu
                Object form of NavigationItem.dropdownMenu : the menu items plus menu-level options.
                  items
                  array of NavigationItem
                  Required
                  The menu items.
                  itemsPerColumn
                  number
                  Maximum items rendered in ONE COLUMN — overflowing items wrap into additional columns (e.g. `7` renders a 12-item menu as two columns of 7 + 5). Omit for a single column.
                NavigationItem[]
                NavigationItem[]
              float
              "center" | "right"
              Render this item on the RIGHT of the header rather than with its siblings, before the search box — for a tab that is a reference you look things up in rather than a stop in the reading order (e.g. an API reference). Honored only by the `tabs` appearance, and there only for `"right"` — the union matches WebEditorHeader , which intersects this type and already carries both values. The item keeps everything a centered tab has, including `dropdownMenu` and route-prefix active highlighting.
              pages
              array of NavigationItem
              Nested navigation items — recursive. Honored ONLY by sidebar-dropdown surfaces ( `navigation.sidebarDropdown` and `appearance: "sidebarDropdown"` segments): an entry with `pages` (typically without `page` / `href` ) renders as an inline-expandable GROUP row inside the dropdown popover — clicking it expands its children (indented) within the same popover. `title` , `icon` , and `description` apply to the group row. Other appearances (tabs, logoTrailing) ignore nesting.
              trigger
              "hover" | "click"
              How the `dropdownMenu` opens. Defaults to `"hover"` .
            itemsPerColumn
            number
            Maximum items rendered in ONE COLUMN — overflowing items wrap into additional columns (e.g. `7` renders a 12-item menu as two columns of 7 + 5). Omit for a single column.
          NavigationItem[]
          NavigationItem[]
        float
        "center" | "right"
        Render this item on the RIGHT of the header rather than with its siblings, before the search box — for a tab that is a reference you look things up in rather than a stop in the reading order (e.g. an API reference). Honored only by the `tabs` appearance, and there only for `"right"` — the union matches WebEditorHeader , which intersects this type and already carries both values. The item keeps everything a centered tab has, including `dropdownMenu` and route-prefix active highlighting.
        pages
        array of NavigationItem
        Nested navigation items — recursive. Honored ONLY by sidebar-dropdown surfaces ( `navigation.sidebarDropdown` and `appearance: "sidebarDropdown"` segments): an entry with `pages` (typically without `page` / `href` ) renders as an inline-expandable GROUP row inside the dropdown popover — clicking it expands its children (indented) within the same popover. `title` , `icon` , and `description` apply to the group row. Other appearances (tabs, logoTrailing) ignore nesting.
        trigger
        "hover" | "click"
        How the `dropdownMenu` opens. Defaults to `"hover"` .
      NavigationItemButton
      NavigationItem
      Core interface for navigation items
        title
        string
        The navigation item title
        description
        string
        The navigation item description
        page
        string
        The navigation page, if set it redirects to the page + matches based on routing
        href
        string
        The navigation href, if set it redirects but does not match based on routing
        icon
        React.ReactNode
        The navigation item icon
        color
        string
        Accent color (any CSS color) for this item. Used by `logoTrailing` product switchers and accent-aware themes (e.g. `terrarium` ) to recolor the UI per product — the active item's `color` is applied as `--theme-color-primary` .
        dropdownMenu
        Nested navigation rendered as a dropdown menu under this item. Recursive — a child may itself declare `dropdownMenu` to create submenus (e.g. `api → [Browser SDK, REST API, GraphQL]` ). Supported on header anchors and tabs. Accepts a plain item array, or the object form DropdownMenu carrying menu-level options (e.g. `{ itemsPerColumn: 7, items: [...] }` ).
          DropdownMenu
          DropdownMenu
          Object form of NavigationItem.dropdownMenu : the menu items plus menu-level options.
            items
            array of NavigationItem
            Required
            The menu items.
            itemsPerColumn
            number
            Maximum items rendered in ONE COLUMN — overflowing items wrap into additional columns (e.g. `7` renders a 12-item menu as two columns of 7 + 5). Omit for a single column.
          NavigationItem[]
          NavigationItem[]
        float
        "center" | "right"
        Render this item on the RIGHT of the header rather than with its siblings, before the search box — for a tab that is a reference you look things up in rather than a stop in the reading order (e.g. an API reference). Honored only by the `tabs` appearance, and there only for `"right"` — the union matches WebEditorHeader , which intersects this type and already carries both values. The item keeps everything a centered tab has, including `dropdownMenu` and route-prefix active highlighting.
        pages
        array of NavigationItem
        Nested navigation items — recursive. Honored ONLY by sidebar-dropdown surfaces ( `navigation.sidebarDropdown` and `appearance: "sidebarDropdown"` segments): an entry with `pages` (typically without `page` / `href` ) renders as an inline-expandable GROUP row inside the dropdown popover — clicking it expands its children (indented) within the same popover. `title` , `icon` , and `description` apply to the group row. Other appearances (tabs, logoTrailing) ignore nesting.
        trigger
        "hover" | "click"
        How the `dropdownMenu` opens. Defaults to `"hover"` .
      NavigationItemSocial
      NavigationItem
      Core interface for navigation items
        title
        string
        The navigation item title
        description
        string
        The navigation item description
        page
        string
        The navigation page, if set it redirects to the page + matches based on routing
        href
        string
        The navigation href, if set it redirects but does not match based on routing
        icon
        React.ReactNode
        The navigation item icon
        color
        string
        Accent color (any CSS color) for this item. Used by `logoTrailing` product switchers and accent-aware themes (e.g. `terrarium` ) to recolor the UI per product — the active item's `color` is applied as `--theme-color-primary` .
        dropdownMenu
        Nested navigation rendered as a dropdown menu under this item. Recursive — a child may itself declare `dropdownMenu` to create submenus (e.g. `api → [Browser SDK, REST API, GraphQL]` ). Supported on header anchors and tabs. Accepts a plain item array, or the object form DropdownMenu carrying menu-level options (e.g. `{ itemsPerColumn: 7, items: [...] }` ).
          DropdownMenu
          DropdownMenu
          Object form of NavigationItem.dropdownMenu : the menu items plus menu-level options.
            items
            array of NavigationItem
            Required
            The menu items.
            itemsPerColumn
            number
            Maximum items rendered in ONE COLUMN — overflowing items wrap into additional columns (e.g. `7` renders a 12-item menu as two columns of 7 + 5). Omit for a single column.
          NavigationItem[]
          NavigationItem[]
        float
        "center" | "right"
        Render this item on the RIGHT of the header rather than with its siblings, before the search box — for a tab that is a reference you look things up in rather than a stop in the reading order (e.g. an API reference). Honored only by the `tabs` appearance, and there only for `"right"` — the union matches WebEditorHeader , which intersects this type and already carries both values. The item keeps everything a centered tab has, including `dropdownMenu` and route-prefix active highlighting.
        pages
        array of NavigationItem
        Nested navigation items — recursive. Honored ONLY by sidebar-dropdown surfaces ( `navigation.sidebarDropdown` and `appearance: "sidebarDropdown"` segments): an entry with `pages` (typically without `page` / `href` ) renders as an inline-expandable GROUP row inside the dropdown popover — clicking it expands its children (indented) within the same popover. `title` , `icon` , and `description` apply to the group row. Other appearances (tabs, logoTrailing) ignore nesting.
        trigger
        "hover" | "click"
        How the `dropdownMenu` opens. Defaults to `"hover"` .
    sidebar
    Sidebar anchors
      top
      array of NavigationItem
      bottom
      array of NavigationItem

Turn a header anchor or a tab into a nested menu with dropdownMenu. Each entry is a Navigation Item; an entry that itself declares dropdownMenu becomes a submenu, so menus can nest to multiple levels.

Use trigger to control how the menu opens — "hover" (default) or "click".

Style the dropdown — chevron rotation, edge-to-edge items, colors — via appearance.navigationDropdown.

SegmentsExperimental

asset

Segments allows you to create smaller navigational structures based on specific route. Thanks to that you can create for example a subheader that will shown only on specific route:

Segments API Reference
Check the full Segment API Reference
    route
    string
    Route this segment is scoped to. When a **string**, the segment only shows under that route prefix (route-scoped). When **omitted or `false` **, the segment is GLOBAL — always visible (e.g. a top-level product switcher). The globalness comes from the absence of a route, NOT from the `appearance` .
    title
    string
    Title of this segment
    appearance
    Appearance of this segment — a SegmentAppearance string, or the object form SegmentAppearanceConfig carrying kind-specific options (e.g. `{ kind: "sidebarDropdown", options: { fixed: true } }` ).
      SegmentAppearance
      SegmentAppearance "sidebarDropdown" | "logoTrailing" | "tabs"
      How a matched Segment is presented. - `"sidebarDropdown"` — a click dropdown at the top of the sidebar. - `"logoTrailing"` — a hover product-switcher rendered right after the logo (wherever the active theme places its logo — header or sidebar). The trigger shows the active page's title (falling back to the segment `title` ), and the menu is the segment `pages` with a check on the active one. - `"tabs"` — a horizontal tab bar in the sub-navigation, scoped to the segment's `route` . Each `page` is a section: its `page` (a route prefix) decides which tab is active, and its `href` is the landing page the tab links to. Use one route-scoped `tabs` segment per product to get per-product tab bars (e.g. Documentation / API / CLI).
      SegmentAppearanceConfig
      SegmentAppearanceSidebarDropdown
      `appearance: { kind: "sidebarDropdown", options }`
        kind
        "sidebarDropdown"
        Required
        options
          fixed
          boolean
          Render the section switcher in the sidebar's FIXED (pinned) region — it stays visible while the item list scrolls. Defaults to `false` (rendered at the top of the scrollable list).
    trigger
    "hover" | "click"
    How a `logoTrailing` segment's dropdown opens. Defaults to `"hover"` .
    iconOnly
    boolean
    `logoTrailing` only: render the trigger ICON-ONLY — show the active item's icon at a larger size and hide the trigger title label. Use when the icon is a full wordmark image (logo + product name) so a text label is redundant. Defaults to `false` .
    component
    `logoTrailing` only: a custom component rendered AS this segment's dropdown PANEL (e.g. a rich multi-column product mega-menu), instead of the default `pages` list. A path to a default-export React component (relative to the docs project), or `{ import, props }` . Resolved through the same user-components registry as sidebar `ComponentPage` components, so it may use `@xyd-js/framework/react` hooks; the framework also passes it the active item, the segment, and the resolved `items` .
      ComponentPageImport
      ComponentPageImport
      Object form of `ComponentPage.component` : an import path plus optional props.
        import
        string
        Required
        Path to a default-export React component, relative to the docs project.
        props
        Record<string, any>
        Props passed to the component.
      string
      string
    pages
    array of NavigationItem
    Required
    Core interface for navigation items
      title
      string
      The navigation item title
      description
      string
      The navigation item description
      page
      string
      The navigation page, if set it redirects to the page + matches based on routing
      href
      string
      The navigation href, if set it redirects but does not match based on routing
      icon
      React.ReactNode
      The navigation item icon
      color
      string
      Accent color (any CSS color) for this item. Used by `logoTrailing` product switchers and accent-aware themes (e.g. `terrarium` ) to recolor the UI per product — the active item's `color` is applied as `--theme-color-primary` .
      dropdownMenu
      Nested navigation rendered as a dropdown menu under this item. Recursive — a child may itself declare `dropdownMenu` to create submenus (e.g. `api → [Browser SDK, REST API, GraphQL]` ). Supported on header anchors and tabs. Accepts a plain item array, or the object form DropdownMenu carrying menu-level options (e.g. `{ itemsPerColumn: 7, items: [...] }` ).
        DropdownMenu
        DropdownMenu
        Object form of NavigationItem.dropdownMenu : the menu items plus menu-level options.
          items
          array of NavigationItem
          Required
          The menu items.
          itemsPerColumn
          number
          Maximum items rendered in ONE COLUMN — overflowing items wrap into additional columns (e.g. `7` renders a 12-item menu as two columns of 7 + 5). Omit for a single column.
        NavigationItem[]
        NavigationItem[]
      float
      "center" | "right"
      Render this item on the RIGHT of the header rather than with its siblings, before the search box — for a tab that is a reference you look things up in rather than a stop in the reading order (e.g. an API reference). Honored only by the `tabs` appearance, and there only for `"right"` — the union matches WebEditorHeader , which intersects this type and already carries both values. The item keeps everything a centered tab has, including `dropdownMenu` and route-prefix active highlighting.
      pages
      array of NavigationItem
      Nested navigation items — recursive. Honored ONLY by sidebar-dropdown surfaces ( `navigation.sidebarDropdown` and `appearance: "sidebarDropdown"` segments): an entry with `pages` (typically without `page` / `href` ) renders as an inline-expandable GROUP row inside the dropdown popover — clicking it expands its children (indented) within the same popover. `title` , `icon` , and `description` apply to the group row. Other appearances (tabs, logoTrailing) ignore nesting.
      trigger
      "hover" | "click"
      How the `dropdownMenu` opens. Defaults to `"hover"` .

Logo TrailingComing Soon

Set a segment's appearance to "logoTrailing" to render it as a product-switcher right after the logo — wherever your theme places the logo (header, or the sidebar like picasso). Unlike sidebarDropdown, it is global: it appears on every page (a top-level switcher), so you can switch products from anywhere — including the landing page. The trigger shows the active product (whichever page prefixes the current route), falling back to the segment title when none is active; the menu switches between the segment pages (the active one is checked).

This suits docs that span multiple products — e.g. a Products switcher over Session Replay and Web Analytics:

The dropdown opens on trigger: "hover" (default) or "click". A page may itself declare a nested dropdownMenu to add submenus.

File-Convention RoutingComing Soon

File-convention routing is powerful because you don't need any configuration but also has some limitations.
If you need more control over the routing, you need to use the settings based routing instead.

Using file-convention routing means the generated HTML pages are mapped from the directory structure of the source Markdown files.

For example, given the following directory structure:

The generated HTML pages will be:

index.md

If you crate an index.md file at root of your documentation project, xyd will serve that content as index page.

Built with

Show your support! Star us on GitHub ⭐️