Description
react-lines-ellipsis is a multiline ellipsis component for React. It clamps a block of text to a maximum number of lines and shows an ellipsis at the end, so long text fits its box. You pass the text prop, and maxLine sets how many lines are allowed, defaulting to one. The ellipsis prop sets the text of the ellipsis. trimRight, which defaults to true, trims the end of the clamped text so the ellipsis does not sit on an empty line. basedOn chooses whether the text is split by letters or by words, and by default it guesses from your text. The component tag can be changed with the component prop, and onReflow is called when the reflow completes with a clamped flag and the text. The isClamped method reports whether the text is clamped. The README lists limits: it does not clamp on the server or with JavaScript disabled, it accepts plain text by default, it can be fooled by some styles such as first-letter and ligatures, and it needs modern browsers. An experimental unsafeHTML prop supports HTML truncation, and a CSS-based loose version is described for some WebKit browsers.…
Highlights
- Clamps text to a set number of lines
- Custom ellipsis, trimming and letter or word splitting
- Reflow callback and isClamped method
- Responds to window resize and orientation change
- Experimental HTML truncation
Ratings & Reviews
No ratings yet
Be the first to rate react-lines-ellipsis.
People also visit

react-truncate-inside
React component that truncates text in the middle with an ellipsis
react-lines-ellipsis FAQ
What does it do?
It is a multiline ellipsis component for React. It cuts text to a set number of lines and shows an ellipsis at the end.
How do I set the number of lines?
Use the maxLine prop. It accepts a number or a string, and the default is one line.
Does it work on the server?
No. The README says it does not clamp text on the server side or with JavaScript disabled.
Can it truncate HTML?
Only experimentally. Pass unsafeHTML instead of text, and use ellipsisHTML for a custom ellipsis, as the README describes.
What are its known limits?
It can be fooled by some styles, such as first-letter and ligatures, and it needs modern browsers.
What are the best react-lines-ellipsis alternatives?
Popular alternatives to react-lines-ellipsis include react-text-truncate, react-multiline-clamp and react-truncate-inside. See all react-lines-ellipsis alternatives




















