White Space
Decides whether text wraps and whether the whitespace in it is collapsed. It is the CSS property described at MDN Docs, and text-wrap is another name for the same property here rather than a separate one.
.row { display: flex; gap: 6px; margin-bottom: 12px; } button { padding: 4px 10px; background-color: #d8dde3; border-radius: 4px; } button.on { background-color: coral; color: white; } .sample { width: 240px; padding: 8px; background-color: #eef1f4; }
Values
normal(default) — whitespace is collapsed and the text wraps.nowrap— whitespace is collapsed and the text does not wrap.pre— whitespace is preserved and the text does not wrap.pre-wrap— whitespace is preserved and the text wraps.pre-line— the text wraps, but whitespace is collapsed rather than only the spaces: TextMeshPro keeps or collapses whitespace as a whole, so this isnormalin practice.break-spaces— behaves aspre-wrap.
Notes
text-wrapsets this same property, sotext-wrap: nowrapandwhite-space: nowrapdo the same thing and the later of the two wins. Itsbalance,prettyandstablevalues are accepted and read aswrap, since TextMeshPro has no way to refine where a line breaks.- The property is inherited, so setting it on a container covers the text inside it.
- Wrapping is what makes a
<text>measure taller than one line; changing it re-measures the element and can move its siblings.