xiaody / react-lines-ellipsis

Simple multiline ellipsis component for React.JS

Home Page:https://xiaody.github.io/react-lines-ellipsis/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support a width prop

WORLDI opened this issue · comments

Hello,
I wish to support a width prop, when a text is shorter than width, it just show like text, and when text is longer than width, the text should be cut down and show with an ellipsis. Now i set the style={{width: xxx}} to the component, when text is shorter than width, the component width is not fit-content, it is longer than text's width. Like this:
image

If you want to clamp a single line by width, you don't need this component. Just use simple CSS https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow

Close due to inactivity.