Overrides
Replace the sidebar, table of contents, page header or pager with your own markup.
DocsShell draws four parts of every doc page itself: the sidebar, the table of
contents, the page header (breadcrumbs, reading time and Copy page) and the
pager (the previous and next links). Pass a snippet to replace any of them. Each
snippet is an override: it receives what its part shows, and the shell keeps
the part’s place on the page.
Wrap the built-in part
Each built-in part is exported and takes exactly the object its snippet receives, so an override can add to the default instead of rebuilding it. Spread the props on and put your own markup around it:
A table of contents and a page header
The same pattern works for the other two. This keeps only the h2 headings in
the table of contents, and puts a “Report an issue” link beside the built-in
page header:
The four overrides
sidebar Snippet<[SidebarProps]> { nav }: the sidebar tree for the version being read, in
reading order, as NavGroup[]. A group's items are pages
({ title, url }) or nested groups; tell them apart with isNavGroup. Built-in: Sidebar.toc Snippet<[TableOfContentsProps]> { items, activeId }: the page's h2 and h3 headings ({ id, title, depth }) and the id of the one in view, or null. Built-in: TableOfContents.pageHeader Snippet<[PageHeaderProps]> { path, breadcrumbs, readingMinutes, copyPage }: the
current path, the trail to the page (its groups, then the page itself without a url), the reading time in minutes (absent with readingTime={false}) and whether to offer Copy page. Built-in: PageHeader.pager Snippet<[PagerProps]> { prev, next }: the previous and next pages in reading
order, each { title, url } or absent. Built-in: Pager.The types are exported too: SidebarProps, TableOfContentsProps, PageHeaderProps and PagerProps, and what they carry, NavGroup, NavItem, NavNode, Breadcrumb and TocItem.
What the shell keeps
An override replaces what’s inside a part, not where it sits. The shell keeps the sticky sidebar and table-of-contents columns, their widths and the point where they collapse, and the rule above the pager. On small screens the sidebar override fills the menu and the table-of-contents override fills the “On this page” popover, so one override covers both. The popover only appears on pages with headings.
The archived-version banner, the edit link and last-updated row, and the
feedback widget stay the shell’s. The site header takes the logo and actions snippets, and the footer the footer snippet (see DocsShell).
The page layout has none of these parts
With layout="page" the shell draws no sidebar, table of contents, page header
or pager, so those overrides are ignored there.