FeaturesCMSComponents
PreviousNext

Table of Contents

Enable users to navigate through your content with an interactive table of contents and progress indicator.

An interactive table of contents with progress tracking and active section highlighting. Automatically detects headings and provides smooth navigation for long-form content.

Installation

Install the required dependencies:

The TOC component requires the Fumadocs core package for the TableOfContents type.

pnpm add '@kit/cms@workspace:*'

Make sure that the following kit packages are present in your project:

The TOC component uses internal kit packages that should already be available in your project:

Copy and paste the following code into your project.

components/ui/toc.tsx
'use client';

import { Icon } from '@kit/ui/icon';
import * as React from 'react';
import { createContext, useContext } from 'react';
import type { TableOfContents } from 'fumadocs-core/server';
import { cn } from '@kit/shared';

export { type TableOfContents };
Get the Kit
Kit required to see the full code

Update the import paths to match your project setup.

Usage

import { type TableOfContents, Toc, TocContent, TocNav, TocProgressIndicator, TocTitle } from '@kit/cms/ui/toc';
<Toc toc={sampleToc} variant="indented" referenceTop={57} single={false}>
    <div className="flex flex-col gap-2 p-4 pt-0 text-sm">
        <TocTitle title="Table of Contents" />
        <TocContent>
            <TocProgressIndicator />
            <TocNav />
        </TocContent>
    </div>
</Toc>

Features

  • Visual progress indicator with indented or straight variants
  • Active section tracking - single or multiple mode
  • Responsive design for all screen sizes
  • Smooth scroll updates with requestAnimationFrame optimization

Toc Data

To be able to use this component with your fumadocs and your notion content, you use the same type as the Fumadocs TOC component. The notion client take care to return a compatible toc object.

The fumadocs type is exported from the @kit/cms/ui/toc package.

import { type TableOfContents } from '@kit/cms/ui/toc';

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 10/17/2025