src/docs/word-break.mdx
import { ApiTable } from "@/components/api-table.tsx"; import { Example } from "@/components/example.tsx"; import { Figure } from "@/components/figure.tsx"; import { ResponsiveDesign } from "@/components/content.tsx";
export const title = "word-break"; export const description = "Utilities for controlling word breaks in an element.";
<ApiTable rows={[ ["break-normal", "word-break: normal;"], ["break-all", "word-break: break-all;"], ["break-keep", "word-break: keep-all;"], ]} />
Use the break-normal utility to only add line breaks at normal word break points:
<!-- [!code classes:break-normal] -->
<p class="break-normal">The longest word in any of the major...</p>
Use the break-all utility to add line breaks whenever necessary, without trying to preserve whole words:
<!-- [!code classes:break-all] -->
<p class="break-all">The longest word in any of the major...</p>
Use the break-keep utility to prevent line breaks from being applied to Chinese/Japanese/Korean (CJK) text:
<!-- [!code classes:break-keep] -->
<p class="break-keep">抗衡不屈不挠...</p>
For non-CJK text the break-keep utility has the same behavior as the break-normal utility.