React component for clamping lines. It adds ellipsis if text exceeds the defined max lines value
Install package using yarn
or npm
$ yarn add react-clampio
$ npm install react-clampio --save
Pass to the component text that should be truncated:
import Clampio from 'react-clampio';
...
const longText = 'Lorem ipsum ...';
<Clampio
text={longText}
lines={3}
/>
Name | Type | Required | Description |
---|---|---|---|
text | string | true | Text to truncate |
lines | number | false | Maximum lines (default 2) |
ellipsis | string | fasle | Symbol at the end of truncated text (default ...) |
className | string | false | Custom classname |