Truncate strings like butter.
This library relies on spaces for truncation. Thanks @dschinkel for pointing that out.
🚀 ultra-blazingly-fast
🌈 ultra-light: 1.76 KB
yarn add react-truncate-string
import TruncateString from 'react-truncate-string'
...
render(){
return <TruncateString text="your long string" />
}
import TruncateString from 'react-truncate-string'
...
render(){
return <TruncateString text="your long string" truncateAt={90} />
}
https://albinotonnina.github.io/react-truncate-string
https://codesandbox.io/s/xvv9r5ozo
PRs accepted.
- truncate by words?
- min start and end characters option?
- change debounce time with option?
MIT © 2020 Albino Tonnina