nanoclamp
![NPM Status](https://img.shields.io/npm/dm/nanoclamp.svg?style=flat-square)
Responsive text clamping component. Inspired by react-clamp-lines, but smaller (~1KB).
Install
npm install nanoclamp --save
Usage
import NanoClamp from 'nanoclamp';
<NanoClamp
className="custom-class"
is="p"
lines="4"
text={'Some text to clamp.'}
/>
API
prop | type | default value | description |
---|
className | string | | CSS classname(s) added to the string |
is | string | 'div' | DOM selector used to render the string |
lines | number | 3 | Number of visible lines |
text | string | | Text you wish to clamp |
License
nanoclamp © Microlink, Released under the MIT License.
Adapted from react-clamp-lines
by Brad Adams with help from contributors.
microlink.io · GitHub @MicrolinkHQ · Twitter @microlinkhq