Custom themes
Replace the default documentation theme with a project-owned theme.
Use a custom theme when the default documentation layout is not enough for your project. A custom theme is a local TypeScript module that implements the docs theme contract.
Configure the theme path
Point theme.path at the local theme directory or entrypoint in the project's
docs.config.ts:
The theme path is resolved from the project root. Keep the theme in the consumer project so its layout and styling remain fully owned by that project.
Theme contract
A custom theme is defined in the consumer project, not inside the package.
Create src/themes/custom/index.tsx next to the project's docs.config.ts.
That module must export a default DocsThemeContract object with the required
name and Layout fields. Other components are optional and can replace the
default navbar, sidebar, table of contents, breadcrumbs, pager, or search
dialog.
The Layout component itself can live in the same directory:
The layout receives the resolved site configuration, navigation tree, current
page, table-of-contents data, and previous/next page links through
DocsLayoutProps. Use those values instead of coupling the theme to a
specific documentation site's content.
Keep runtime behavior separate
Use docs.config.ts for site configuration such as title, navigation, and
the default color mode. Use the theme module for layout and component
composition. Keep colors and design tokens in the project's CSS entrypoint.