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

Make text/HTML to accept children instead

renatoi opened this issue · comments

It would be a lot better if this component could accept children instead of having 2 versions, one for text and another for HTML (with unsafe stuff).

This should be possible:

<Ellipsis
  maxLine='3'
  ellipsis='...'
  trimRight
  basedOn='letters'
>
  <span>Foo</span> bar!
</Ellipsis>

I don't think it's possible to accept dynamic React nodes as HTML input. Clamping and React nodes rendering would definitely conflict on operating the DOM. If we plan to just handle static stuff, it's no difference using a prop or children.