Browse documentation
Reference / Typography
Text overflow
Keep a long label on a single line and show an ellipsis where it exceeds the available width.
Working example
Production schedule for the winter anthology
Give the element a constrained width. In a flex row, min-w-0 on the shrinking item lets it become narrow enough to truncate.
<p class="truncate max-w-[18ch] border px-3 py-2">
Production schedule for the winter anthology
</p>Class reference
| Class | CSS declarations |
|---|---|
truncate | overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap; |
text-ellipsis | text-overflow: ellipsis; |
text-clip | text-overflow: clip; |
whitespace-nowrap | white-space: nowrap; |
overflow-hidden | overflow: hidden; |
View full generated CSS
.text-clip {
text-overflow: clip;
}
.text-ellipsis {
text-overflow: ellipsis;
}
.overflow-hidden {
overflow: hidden;
}
.truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.whitespace-nowrap {
white-space: nowrap;
}