Documentation Blocks

Reusable documentation components from @/lib/docs

10 components2 hooks

DocLayout

Full documentation page layout with sidebar, search, and responsive mobile support.

DocLayout Preview

Schematic view of DocLayout with sidebar, content area, and table of contents

Table of Contents

Auto-generated TOC from markdown headings with scroll spy and smooth scrolling.

Table of Contents
Markdown source
## Introduction

This is a sample document to demonstrate the Table of Contents component.

### Getting Started

Start by installing the package with your preferred package manager.

### Configuration

Configure the library by creating a config file at the root of your project.

## Advanced Usage

### Custom Themes

You can customize the appearance using CSS variables.

### Plugins

Extend functionality with the plugin system.
Generated TOC

DocContent

Content wrapper with styled header, title gradient, description, and prose styling.

Content Wrapper

Getting Started

Learn how to set up and use the documentation system in your project.

Installation

Install the package using your preferred package manager:

pnpm add @your-org/docs

Basic Usage

Import the components and use them in your application. The DocLayout component provides a complete documentation page structure.

Reading Progress

Animated progress bar fixed at the top showing scroll position.

Reading Progress Indicator
35% progress
78% progress

The actual component is fixed at the top of the viewport and tracks scroll automatically

DocNavigation

Previous/Next navigation between documentation pages.

Code Highlight

Wrapper that applies Prism.js syntax highlighting to code blocks.

Code Highlighting
interface DocConfig {
  title: string;
  basePath: string;
  locale: "en" | "zh";
  sidebar: DocItem[];
}

function createDocsApp(config: DocConfig) {
  return {
    ...config,
    getStructure: () => getDocsStructure(config.locale),
  };
}

MDX Cards

Card and CardGrid components for navigation links within MDX documentation.