Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Finding an intuitive solution for line breaks in PortableText.

5 replies
Last updated: Feb 18, 2024
Hi there! Why line breaks have to be that much of a pain in PortableText? Did you guys found any intuitive solution so you get an empty line on each press of the Enter key?
Jan 30, 2024, 10:21 AM
Do you mean the output of the PortableText? You can use the
white-space: pre-line;
on the element, then linebreaks are treated as br/
Jan 30, 2024, 3:31 PM
For now im using Shift+Enter for line breaks but i will try
pre-line
as soon as i find some time. Thanks!
Feb 1, 2024, 9:11 PM
Hello
user G
I added
white-space: pre-line
on my rich text components like this:
Feb 18, 2024, 12:15 PM
but the text editor treats line breaks as
<p>
tags:
Feb 18, 2024, 12:16 PM
how can i stop this behaviour?
Feb 18, 2024, 12:16 PM

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?