React wrapper for @konforti/truncate
- Truncate text by number of lines.
- Truncate form end, start or middle.
- Responsive truncation.
- Get notified if a text has been truncated or not.
- Custom ellipsis.
npm i -S @konforti/react-truncate
yarn add @konforti/react-truncate
import Truncate from '@konforti/react-truncate';
<Truncate truncFrom="middle">{text}</Truncate>
<Truncate lines={3}>{text}</Truncate>
<Truncate ellipsis=">>> " truncFrom="start">
{text}
</Truncate>
<Truncate
onTruncate={truncated => {
if (truncated) {
setState({ truncated: true });
}
}}
>
{text}
</Truncate>