panelui

Table of Contents

Component

About

The sections of a long page as a quiet rail, with one mark that moves to what you are reading.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Table of Contents to your project and fits it to your theme.

Code

How Table of Contents is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

'use client';

import { TableOfContents } from '@/components/ui/panel-table-of-contents';
export default function TableOfContentsNested() {
  return (
    <div className="w-full max-w-xs rounded-xl border bg-card p-4">
      <TableOfContents defaultValue="presets">
        <TableOfContents.Title>On this page</TableOfContents.Title>
        <TableOfContents.List>
          <TableOfContents.Item value="overview">
            <TableOfContents.Link href="#toc-nested-overview">Overview</TableOfContents.Link>
          </TableOfContents.Item>
          <TableOfContents.Item value="installation">
            <TableOfContents.Link href="#toc-nested-installation">Installation</TableOfContents.Link>
          </TableOfContents.Item>
          <TableOfContents.Item value="npm" depth={1}>
            <TableOfContents.Link href="#toc-nested-npm">From npm</TableOfContents.Link>
          </TableOfContents.Item>
          <TableOfContents.Item value="manual" depth={1}>
            <TableOfContents.Link href="#toc-nested-manual">By hand</TableOfContents.Link>
          </TableOfContents.Item>
          <TableOfContents.Item value="configuration">
            <TableOfContents.Link href="#toc-nested-configuration">Configuration</TableOfContents.Link>
          </TableOfContents.Item>
          <TableOfContents.Item value="presets" depth={1}>
            <TableOfContents.Link href="#toc-nested-presets">Presets</TableOfContents.Link>
          </TableOfContents.Item>
          <TableOfContents.Item value="api">
            <TableOfContents.Link href="#toc-nested-api">API reference</TableOfContents.Link>
          </TableOfContents.Item>
        </TableOfContents.List>
      </TableOfContents>
    </div>
  );
}

Dependencies

More by panelui

View all
  • Spinner

    Spinner

    7
  • Flow

    Flow

    3
  • Treemap Chart

    Treemap Chart

    1
  • Soundwave

    Soundwave

    1
  • Share

    Share

    1
  • Scatter Chart

    Scatter Chart

    1
  • Pyramid Chart

    Pyramid Chart

    1
  • Model Picker

    Model Picker

    1