FeaturesCMSComponents
PreviousNext

Table of Contents

TOC components for structured long-form content navigation.

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 TableOfContents data object.

How To Use

Component source

components/ui/toc.tsx
'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 code

Video 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 scroll

Agent Recipe

  1. Pass TOC data from your renderer/content pipeline.
  2. Choose visual mode (indented or other variant).
  3. Verify active section updates while scrolling.

Troubleshooting

  • Wrong highlight behavior usually means incorrect heading IDs or offset settings.

API Reference

Root

TocProps

PropTypeDefault
className
string
title
string
'On This Page'
toc*
TableOfContents
variant
"straight" | "indented"
referenceTop
number
single
boolean

Title

TocTitleProps

PropTypeDefault
title
string
'On This Page'
className
string

Content

TocContentProps

PropTypeDefault
children
React.ReactNode
className
string

Progress Indicator

TocProgressIndicatorProps

PropTypeDefault
className
string

TocNavProps

PropTypeDefault
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} />

How is this guide?

Last updated on 3/23/2026