React component that trims overflowing multi line text and adds a specified tail
Install from NPM:
npm install react-text-trim
className
: default : empty string
CSS class name to add specific styling
textTail
: default : ...
String to append to end of trimmed text
maxLines
: default : 3
Number of lines to render before truncating text
import Trimmer from 'react-text-trim';
<div className = 'my-text'>
<Trimmer maxLines = {2} textTail = '...' >
Some text to be truncated
</Trimmer>
</div>
This repository is configured with EditorConfig.