Table of Contents
TOC components for structured long-form content navigation.
Table of Contents
What It Does
@kit/cms/ui/toc provides TOC primitives compatible with Fumadocs-style heading structures.
When To Use
- Docs pages with many heading sections.
Prerequisites
- A
TableOfContentsdata object.
Important
This page describes the standard kit integration path; adapt app-specific paths and config names when your project differs.
How To Use
Component source
'use client';
import { Icon } from '@kit/ui/icon';
import { cn } from '@kit/utils';
import type { TableOfContents } from 'fumadocs-core/toc';
import * as React from 'react';
import { createContext, useContext } from 'react';
export type { TableOfContents };
Get the Kit
Kit required to see the full codeVideo walkthrough
Example long-form page where TOC improves section navigation
Usage example
import { Toc, TocContent, TocNav, TocProgressIndicator, TocTitle } from '@kit/cms/ui/toc';
<Toc toc={toc} variant="indented" referenceTop={57} single={false}>
<TocTitle title="Table of Contents" />
<TocContent>
<TocProgressIndicator />
<TocNav />
</TocContent>
</Toc>MCP Context
capability: toc_ui
entrypoints:
- @kit/cms/ui/toc
inputs:
- table_of_contents_data
outputs:
- heading_navigation_ui
constraints:
- TOC item structure must match expected type
side_effects:
- updates active heading state during scrollAgent Recipe
- Pass TOC data from your renderer/content pipeline.
- Choose visual mode (
indentedor other variant). - Verify active section updates while scrolling.
Troubleshooting
- Wrong highlight behavior usually means incorrect heading IDs or offset settings.
Related
API Reference
Root
TocProps
| Prop | Type | Default |
|---|---|---|
className | string | |
title | string | 'On This Page' |
toc* | TableOfContents | |
variant | "straight" | "indented" | |
referenceTop | number | |
single | boolean |
Title
TocTitleProps
| Prop | Type | Default |
|---|---|---|
title | string | 'On This Page' |
className | string |
Content
TocContentProps
| Prop | Type | Default |
|---|---|---|
children | React.ReactNode | |
className | string |
Progress Indicator
TocProgressIndicatorProps
| Prop | Type | Default |
|---|---|---|
className | string |
Nav
TocNavProps
| Prop | Type | Default |
|---|---|---|
className | string |
SimpleToc
Use this components to avoid the pain of handling all the previous components.
<SimpleToc toc={toc} variant="indented" referenceTop={100} single={false} />Scroll to Top
Floating button to jump to top of long content pages.
Roadmap
Publish product roadmap items from Notion-backed content.
How is this guide?
Last updated on 3/23/2026