react-clamp-future
v1.0.3
Published
Clamping multiline text
Downloads
5
Readme
React Clamp
This project is simple React version of Vue Clamp
Installation
To install the stable version:
npm install --save react-clamp
Usage
import Clamp from 'react-clamp'
<Clamp
text='React makes it painless to create interactive UIs.'
maxLine={2}
/>
Add children render as tail of clamped text
import Clamp from 'react-clamp'
<Clamp
text='React makes it painless to create interactive UIs.'
maxLine={2}
>
<button>New</button>
</Clamp>
Options
text
Type: string
Required
The text you want to clamp.
maxLine
Type: number
Required
Max count of lines allowed.
Development
Serve with hot reload at localhost:5173
:
yarn dev
Build:
yarn build
Todo
- [ ] Build "smooth" version with state instead of using
useRef
- [ ] Add more feature
- [ ] Built doc site by e11y/astro