nanoclamp
Responsive text clamping component.
Install
npm install nanoclamp --save
Features
- built for
React
with no dependencies - customizable CSS classes
- responsive
- window resize event
debounced
— and why it's important
Usage
import NanoClamp from 'nanoclamp';
...
<NanoClamp
text={'Some text to clamp.'}
lines="4"
className="custom-class"
/>
API
prop | type | default value | description |
---|
text | string | | Text you wish to clamp |
lines | number | 3 | Number of visible lines |
className | string | | CSS class names added to component |
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