Utilities for controlling text overflow in an element.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiisitaquequodpraesentiumexplicaboincidunt? Dolores beatae nam at sed dolorum ratione dolorem nisi velit cum.
<p class="truncate ...">...</p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiisitaquequodpraesentiumexplicaboincidunt? Dolores beatae nam at sed dolorum ratione dolorem nisi velit cum.
<p class="overflow-ellipsis overflow-hidden ...">...</p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiisitaquequodpraesentiumexplicaboincidunt? Dolores beatae nam at sed dolorum ratione dolorem nisi velit cum.
<p class="overflow-clip overflow-hidden ...">...</p>
To control the text overflow in an element only at a specific breakpoint, add a {screen}:
prefix to any existing text overflow utility. For example, adding the class md:overflow-clip
to an element would apply the overflow-clip
utility at medium screen sizes and above.
<p class="truncate md:overflow-clip ...">
<!-- ... -->
</p>
For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.
By default, only responsive variants are generated for text overflow utilities.
You can control which variants are generated for the text overflow utilities by modifying the textOverflow
property in the variants
section of your tailwind.config.js
file.
For example, this config will also generate hover and focus variants:
// tailwind.config.js
module.exports = {
variants: {
extend: {
// ...
+ textOverflow: ['hover', 'focus'],
}
}
}
If you don't plan to use the text overflow utilities in your project, you can disable them entirely by setting the textOverflow
property to false
in the corePlugins
section of your config file:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ textOverflow: false,
}
}