Page Tree

The structure of page tree.

Page tree is a tree structure that describes all navigation links, with other items like separator and folders.

It will be sent to the client and being referenced in navigation elements including the sidebar and breadcrumb. Hence, you shouldn't store any sensitive or large data in page tree.

Note

By design, page tree only contains necessary information of all pages and folders.

Unserializable data such as functions can't be passed to page tree.

Conventions

The type definitions of page tree, for people who want to hardcode/generate it. You can also import the type from Fumadocs.

import type * as PageTree from 'fumadocs-core/page-tree';

const tree: PageTree.Root = {
  // props
};

Certain nodes contain a $ref property, they are internal and not used when hardcoding it.

Root

The initial root of page trees.

Page

{
  "type": "page",
  "name": "Quick Start",
  "url": "/docs"
}

External urls are also supported

Folder

{
    "type": "folder",
    "name": "Guide",
    "index": {
        "type": "page",
        ...
    }
    "children": [
        ...
    ]
}

Separator

A label between items.

{
  "type": "separator",
  "name": "Components"
}

Icons

Icon is a ReactElement, supported by pages and folders.

On this page