Rich Text Guide
Table of Contents
Working with Rich Text
Rich Text in Val
Val's rich text is based on semantic HTML5 and provides a structured way to define formatted content. Unlike other CMS solutions, Val represents rich text as plain TypeScript objects, making it easy to understand, transform, and render.
Defining Rich Text Schema
Use `s.richtext()` to define a rich text field with configurable formatting options:
Rich Text Structure
Rich text is represented as an array of block elements, where each element has a tag and children:
Rendering Rich Text
Use the `ValRichText` component to render rich text in your React components:
Available Options
Rich text supports three categories of formatting:
Styles: bold, italic, lineThrough, underline
Block elements: p, h1-h6, ul, ol, blockquote, code
Inline elements: a (links), img (images)