Sanity logosanity.ioAll Systems Operational© Sanity 2026
Change Site Theme
Sanity logo

Documentation

    • Overview
    • Platform introduction
    • Next.js quickstart
    • Nuxt.js quickstart
    • Astro quickstart
    • React Router quickstart
    • Studio quickstart
    • Build with AI
    • Content Lake
    • Functions
    • APIs and SDKs
    • Agent Actions
    • Visual Editing
    • Blueprints
    • Platform management
    • Dashboard
    • Studio
    • Canvas
    • Media Library
    • App SDK
    • Content Agent
    • HTTP API
    • CLI
    • Libraries
    • Specifications
    • Changelog
    • User guides
    • Developer guides
    • Courses and certifications
    • Join the community
    • Templates
Studio
Overview

  • Setup and development

    Installation
    Project Structure
    Development
    Hosting and deployment
    Embedding Sanity Studio
    Upgrading Sanity Studio
    Environment Variables
    Using TypeScript in Sanity Studio
    Understanding the latest version of Sanity

  • Configuration

    Introduction
    Workspaces
    Schema and forms
    Conditional fields
    Field Groups
    List Previews
    Connected Content
    Validation
    Initial Value Templates
    Cross Dataset References
    Sort Orders
    Visual editing and preview
    Incoming reference decoration

  • Block Content (Portable Text)

    Introduction
    Configure the Portable Text Editor
    Customize the Portable Text Editor
    Create a Portable Text behavior plugin
    Add Portable Text Editor plugins to Studio
    Common patterns
    Standalone Portable Text Editor

  • Studio customization

    Introduction
    Custom component for Sanity Studio
    Custom authentication
    Custom asset sources
    Diff components
    Form Components
    How form paths work
    Icons
    Favicons
    Localizing Sanity Studio
    New Document Options
    Studio Components
    Studio search configuration
    Focus and UI state in custom inputs
    Real-time safe patches for input components
    Sanity UI
    Studio Tools
    Create a custom Studio tool
    Tools cheat sheet
    Theming

  • Workflows

    The Dashboard tool for Sanity Studio
    Add widgets to dashboard
    Document actions
    Release Actions
    Custom document badges
    Localization
    Content Releases Configuration
    Enable and configure Comments
    Configuring Tasks
    Scheduled drafts
    Scheduled publishing (deprecated)
    Manage notifications

  • Structure builder

    Introduction
    Get started with Structure Builder API
    Override default list views
    Create a link to a single edit page in your main document type list
    Manually group items in a pane
    Dynamically group list items with a GROQ filter
    Create custom document views with Structure Builder
    Cheat sheet
    Structure tool
    Reference

  • Plugins

    Introduction
    Installing and configuring plugins
    Developing plugins
    Publishing plugins
    Internationalizing plugins
    Reference
    Official plugins repo

  • AI Assist

    Installation
    Translation
    Custom field actions
    Field action patterns

  • User guides

    Comments
    Task
    Copy and paste fields
    Compare document versions
    Content Releases
    Scheduled drafts
    View incoming references
    Common keyboard shortcuts

  • Studio schema reference

    Studio schema configuration
    Array
    Block
    Boolean
    Cross Dataset Reference
    Date
    Datetime
    Document
    File
    Geopoint
    Global Document Reference
    Image
    Number
    Object
    Reference
    Slug
    Span
    String
    Text
    URL

  • Studio reference

    Asset Source
    Configuration
    Document
    Document Badges
    Document Actions
    Form
    Form Components
    Hooks
    Structure tool
    Studio Components Reference
    Tools
    Initial Value Templates
    Studio API reference

On this page

Previous

Incoming reference decoration

Next

Configure the Portable Text Editor

Was this page helpful?

On this page

  • Core concepts
  • Portable Text
  • The Portable Text Editor
  • Extending the editor in Studio
  • Rendering Portable Text in your apps
  • Limitations
  • Attribute limits
StudioLast updated June 26, 2025

Block Content

Block content allows you to create a rich text experience tailored to the needs of your content.

Block content in Sanity uses Portable Text, a structured format for rich text that stores content as blocks. It allows you to create content with formatting, custom blocks, and annotations while keeping the content separate from its presentation.

In Sanity Studio, block content lets you build flexible editing experiences where you can include custom content types, add structured data to text, and control how your content appears across different platforms.

Here's what you can do with block content:

  • Create rich text content with customizable styles, decorators, and annotations.
  • Embed custom content blocks like images, videos, or code snippets directly within your text.
  • Add structured data to text through annotations, enabling features like internal linking to references.
  • Customize the editing experience with your own toolbar icons, block styles, and plugins.
  • Serialize Portable Text for a common targets like HTML, React, Vue, Markdown, or even write your own custom serializer.
Get started

Configure the Portable Text Editor

Set up and configure the Portable Text Editor with decorators, annotations, and block content.

Customize the Portable Text Editor

Customization guidelines and examples to tailor the Portable Text editor to your needs.

Core concepts

Portable Text

When you define your schema, you define rich text as an array of blocks. This is the fundamental shape of Portable Text.

Portable Text is built on the idea of rich text as an array of blocks, where each block is an array of child spans.

Blocks

Blocks are units representing paragraphs, headings, or other block-level elements. Each block can have a style (like normal, h1, h2, etc.) and contains an array of spans or inline objects.

Spans

Spans are the text content within blocks. They can have marks applied to them, which are either simple decorators (like bold or italic) or more complex annotations (like links with structured data).

Marks

Marks let you label sections of inline text, either for stylistic reasons for to add additional information to the text. There are two types of marks.

Decorators are simple marks applied to spans, like bold, italic, or inline code formatting. They're stored as string values in the marks array of a span.

Annotations are more complex marks that can contain structured data. For example, a link annotation might include a URL or a reference to another document.

Custom blocks

Beyond text blocks, Portable Text allows you to insert custom content blocks like images, videos, or any other content type you define. These appear as separate items in the Portable Text array.

Common Portable Text Editor patterns

This series of practical examples shows how to customize block content and the Portable Text Editor in Sanity Studio.

The Portable Text Editor

When you use an array of blocks in your schema, Studio inserts a pre-configured version of the Portable Text Editor(PTE). The editor itself is open source and allows you to build on top of the same foundation that Studio uses for its rich text experience. Learn more about the standalone editor.

Extending the editor in Studio

You can customize the built-in editor experience by customizing blocks individually, and by creating behavior plugins. You can even replace the entire editor with your own implementation of the standalone PTE.

Create a Portable Text behavior plugin

Use behavior plugins to add custom interactions to the Portable Text block editor in Studio.

Add Portable Text Editor plugins to Studio

Use official and community-built Portable Text Editor plugins in your studio.

Rendering Portable Text in your apps

Because block content uses the Portable Text specification, you can use any portable text serializer to render the content in your front end code.

Portable Text Serializers

Presenting Portable Text

Transform Portable Text to whatever you want

Libraries and tools

Visit the Portable Text section of the libraries page for serializers that suit your needs.

Limitations

Attribute limits

Block content is powerful, but can sometimes lead to complex documents made up of many attributes. Refer to the advice in this guide on attribute limits to use block content responsibly.

  • Article
  • Changelog