Description
The WordBreak
property in the Sandbox.UI.BaseStyles
class represents the word-break
CSS property. This property specifies how words should break when reaching the end of a line. It is useful for controlling text wrapping and ensuring that text is displayed in a readable manner, especially in narrow containers or when dealing with long words.
Usage
To use the WordBreak
property, you can set it to one of the values defined in the Sandbox.UI.WordBreak
enumeration. This property is nullable, meaning it can be set to null
if you want to remove any specific word-break styling.
Example values include:
WordBreak.Normal
- Use the default line break rules.
WordBreak.BreakAll
- Break words at any character to prevent overflow.
WordBreak.KeepAll
- Prevent word breaks within CJK (Chinese, Japanese, Korean) text.
Example
// Example of setting the WordBreak property
var styles = new BaseStyles();
styles.WordBreak = WordBreak.BreakAll;
// To remove the word-break styling
styles.WordBreak = null;