---
title: "Prose (Rich Text) Module for Sanity"
description: "Long-form rich text for docs, articles, and legal pages, with images, code blocks, tables, Custom HTML, and an optional sidebar."
---

# Prose module

Long-form rich text for docs, articles, and legal pages. Every heading gets an anchor link, and an optional sidebar can hold a table of contents.

[View source on GitHub](https://github.com/nuotsu/sanitypress/tree/main/src/modules/prose) (schema + React component)

## Module fields

| Field | Type | Description |
| --- | --- | --- |
| `content` | Portable Text | The body. See content blocks below. |
| `sidebar` | `sidebar` | Optional sidebar. See sidebar fields below. |
| `attributes` | `module-attributes` | Shared by every module: `uid` (HTML id for deep links), `hidden`, and `scopedCss`. |

## Content blocks

| Block | Description |
| --- | --- |
| `block` | Rich text with headings H1 to H6, lists, and links. Every heading gets an anchor link. |
| `image` | Image with alt text and an optional caption. |
| `ctas` | A row of call-to-actions. |
| `code` | Code block with syntax highlighting and an optional filename. |
| `code-group` | Tabbed code blocks, e.g. npm, pnpm, yarn and bun commands. Groups with the same sync key switch together. |
| `table` | Table with a header row. |
| `custom-html` | Raw HTML and CSS. |

## Sidebar fields

| Field | Type | Description |
| --- | --- | --- |
| `position` | `left` \| `right` | Which side of the content the sidebar sits on. |
| `modules` | array of `callout`, `custom-html`, `tableOfContents` | Stacked inside the sidebar. |
| `tableOfContents.summary` | string | Label for the table of contents, e.g. On this page. |
| `tableOfContents.maxHeadingDepth` | number | Includes headings from H2 up to this level. Defaults to 6. |

## Demo: Long-form content with sidebar

The Prose Module is a sophisticated rich text content system designed to transform your written content into beautifully structured, navigable documents. This very description you're reading was created using the Prose Module itself—demonstrating its capability to handle complex formatting, hierarchical content, and enhanced readability features.

## Core Features

### Rich Text Content

At its heart, the Prose Module leverages Sanity's powerful block editor to provide a comprehensive rich text editing experience. Content creators can:

1. Format text with standard styling options
1. Create structured content with headings, paragraphs, lists, and more
1. Embed media and custom components seamlessly
1. Maintain consistent styling across all content
1. Embed images:

![SanityPress with TypeGen](https://cdn.sanity.io/images/cyu7k2r0/production/c945d8094ba34d9bf31be90c309dff97686e847d-1344x896.jpg)

*SanityPress with TypeGen*

### Automatic Table of Contents

One of the Prose Module's standout features is its intelligent table of contents generation. The system:

- Automatically scans all headings (H1-H6) within your content
- Generates a hierarchical navigation structure with proper indentation
- Provides three positioning options:
  - `none`: No table of contents displayed
  - `left`: Table of contents positioned on the left side
  - `right`: Table of contents positioned on the right side

### Anchored Headings

Every heading in the Prose Module becomes a navigable anchor point:

- Automatic ID generation using URL-friendly slugs derived from heading text
- Permalink symbols (¶) that appear on hover for easy link sharing
- Smooth navigation when clicking table of contents links
- SEO-friendly structure for improved search engine indexing

### Code Blocks and Code Groups

Share code with syntax highlighting, an optional filename and a copy button. When there is more than one way to run something, a code group gives each option its own tab:

```sh
npm create sanitypress
# or
pnpm create sanitypress
yarn create sanitypress
bun create sanitypress
```

Code groups that share a sync key switch together and remember the choice, so readers only pick their package manager once.

## Use Cases

This module is perfect for:

- Documentation (like this very page)
- Knowledge base entries
- Product descriptions with detailed specifications
- Tutorial content with step-by-step navigation
- Technical guides requiring structured navigation

The Prose Module transforms simple rich text into a professional, navigable document experience that enhances both content creation and reader engagement.

### Ready to build your next website with SanityPress?

[Get started today](/docs/get-started)

Frequently Asked Questions

## Prose module FAQ

### When should I use the Prose module?

Use it for long-form content: docs, articles, legal pages like a privacy policy, or any page that is mostly text. It supports headings, lists, images, code blocks with syntax highlighting, tables, call-to-actions, and Custom HTML.

### How do I add the Prose module to a page?

In Sanity Studio, open the page, click Add item in its Modules field, and pick Prose. Fill in the fields, check it in the live Presentation preview, and publish. Modules can be reordered by dragging, and the same module can be used on any page as many times as you need.

### How do I customize the Prose module?

Add an optional sidebar on the left or right with a table of contents, callouts, or Custom HTML. Every heading gets an anchor link automatically, and the table of contents can be limited with maxHeadingDepth.

Every module also has a Scoped CSS field (plus a uid for deep links and a hidden toggle), so you can restyle one instance without touching the rest of the site. For bigger changes, edit the module's React component and schema in src/modules/prose in the repo.

Previous module

![Person list module](https://cdn.sanity.io/images/cyu7k2r0/production/dfbba9602e895cfe0eb5c0e83569203d9d61d2d5-2560x1224.png)

[Person list module](/modules/person-list)

Next module

![Quote list module](https://cdn.sanity.io/images/cyu7k2r0/production/88b1f3bab5106871b5f755804ce51ff2f57520fe-2560x816.png)

[Quote list module](/modules/quote-list)
