TOC Pill

Dec 2025

A Table of Contents component with scroll progress indicator adn spring transtions. Check out my blog articles to see it in full action.

Introduction

This is a demonstration of the Table of Contents component. It provides a convenient way to navigate through long-form content and understand the structure of an article at a glance.

The TOC component automatically tracks which section you're currently viewing and highlights the active heading, making it easy to see your progress through the document.

Scroll through this content to see the TOC component in action. The component will highlight the active section as you scroll, and you can click on any item in the TOC to jump directly to that section.

This makes it easy to navigate long articles and understand the structure of the content at a glance. The TOC is always accessible from the bottom of the screen.

Getting Started

To use the Table of Contents component, you'll need to provide it with a structured data object that represents the headings in your document.

Installation

First, install the necessary dependencies. The component uses Framer Motion for animations and Next.js for routing.

Make sure you have all the required packages installed in your project.

Configuration

Configure the component by passing in the table of contents data and any additional props you need. The component will automatically handle the rest.

You can customize the appearance and behavior through various props and styling options.

Advanced Features

The Table of Contents component includes several advanced features that enhance the user experience.

Customization

You can customize the component's appearance, animations, and behavior to match your design system. The component is built with flexibility in mind.

Explore the various customization options available to create the perfect TOC for your needs.

Best Practices

When implementing a Table of Contents, there are several best practices to keep in mind. These will help ensure a smooth user experience and optimal performance.

Consider the structure of your content, the number of headings, and how users will interact with the TOC component.

Conclusion

The Table of Contents component is a powerful tool for improving navigation in long-form content. It helps users understand the structure of your document and quickly jump to the sections they're interested in.

We hope this demonstration has given you a good understanding of how the component works and how you can use it in your own projects.

The component is fully responsive and works seamlessly across different screen sizes. On mobile devices, it expands to nearly full width for better usability.

Try clicking on different sections in the TOC to see the smooth scroll animation. The component provides an excellent user experience for navigating through long-form content.

This is additional content to ensure there's enough scrollable material to demonstrate the TOC functionality. Keep scrolling to see how the active section updates in real-time.