2.0.9 • Published 1 month ago

nanoclamp v2.0.9

Weekly downloads
2,519
License
MIT
Repository
github
Last release
1 month ago

Last version NPM Status

Storybook

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={2}
  text={'Some text to clamp.'}
/>

API

proptypedefaultdescription
accessibilitybooleantruePass the full unclamped string to the DOM element's title attribute
classNamestringCSS classname(s) added to the string
debouncenumber300Time in milliseconds used for debounce
ellipsisstring'…'String displayed after the clamped text
isstring'div'DOM selector used to render the string
linesnumber3Number of visible lines
textstringText 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

2.0.9

1 month ago

2.0.8

1 month ago

2.0.7

6 months ago

2.0.6

8 months ago

2.0.5

12 months ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.4

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.12

4 years ago

1.2.11

5 years ago

1.2.10

5 years ago

1.2.9

5 years ago

1.2.7

6 years ago

1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago