πŸ‘€ Our most exciting product launch yet πŸš€ Join us May 8th for Sanity Connect

How to Add Line Breaks to a CMS Field's Description

2 replies
Last updated: Nov 30, 2021
hi, is there a way to add line breaks to a CMS field's
description
? I tried using
<br />
, but it gets HTML escaped.
Nov 29, 2021, 11:44 PM
You can do something like:

import React from 'react'

export default {
  name: 'multilineDescription',
  title: 'Multiline Description',
  type: 'document',
  fields: [
    {
      name: 'title',
      title: 'Title',
      type: 'string',
      description: <>First line<br />Second line</>,
    },
  ]
}
Nov 30, 2021, 12:01 AM
thanks
user A
! Worked like a charm!
Nov 30, 2021, 8:54 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?