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

Give the element a constrained width. In a flex row, min-w-0 on the shrinking item lets it become narrow enough to truncate.

HTML
<p class="truncate max-w-[18ch] border px-3 py-2">
  Production schedule for the winter anthology
</p>

Class reference

ClassCSS declarations
truncateoverflow: hidden; text-overflow: ellipsis; white-space: nowrap;
text-ellipsistext-overflow: ellipsis;
text-cliptext-overflow: clip;
whitespace-nowrapwhite-space: nowrap;
overflow-hiddenoverflow: hidden;
View full generated CSS
Compiled 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;
}