/react-text-trimmer

React component that trims overflowing multi line text and adds a specified tail

Primary LanguageJavaScriptMIT LicenseMIT

NPM version Build status dependencies Status devDependencies Status peerDependencies Status

react-text-trimmer

React component that trims overflowing multi line text and adds a specified tail

Installation

Install from NPM:

npm install react-text-trim

Usage

Props

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

Example

import Trimmer from 'react-text-trim';

<div className = 'my-text'>
	<Trimmer maxLines = {2} textTail = '...' >
 		Some text to be truncated
	</Trimmer>
</div>

Code Style

This repository is configured with EditorConfig.