Dev Helpers
← Back

Line-preserving caption

Import and render <LinePreservingCaption /> in a React project.

Open this example in the interactive library

Live preview

Source code

// components/LinePreservingCaption.tsx

export default function LinePreservingCaption({
  text = "Studio notes from the harbour",
}: { text?: string } = {}) {
  return <p style={{ whiteSpace: "pre-line", overflowWrap: "anywhere" }}>{text}</p>;
}