react-clamp-future
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

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>

SCR-20220724-vx5

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

Package Sidebar

Install

npm i react-clamp-future

Weekly Downloads

4

Version

1.0.3

License

MIT

Unpacked Size

23.8 kB

Total Files

14

Last publish

Collaborators

  • nguythang