react-threedot

1.5.1 • Public • Published

React multi-line ellipsis

Npm version Npm Download Build Status

Install

npm install react-text-ellipsis

Usage

Require TextEllipsis to wrap text (not any component!) and parent element must have width, height, overflow: hidden well set!, span tag is not working (div, p works)

Build react-text-ellipsis:

npm run build

Build example

npm run example

then see example/index.html

Example usage:

import TextEllipsis from 'react-text-ellipsis';

<label>
    <TextEllipsis 
        lines={2} 
        tag={'p'} 
        ellipsisChars={'...'} 
        tagClass={'className'} 
        debounceTimeoutOnResize={200} 
        useJsOnly={true} 
        onResult={(result) => { 
            if (result === TextEllipsis.RESULT.TRUNCATED)
                console.log('text get truncated');
            else 
                console.log('text does not get truncated');
            }}>
        Hello world
    </TextEllipsis>
</label>
 

Readme

Keywords

Package Sidebar

Install

npm i react-threedot

Weekly Downloads

10

Version

1.5.1

License

MIT

Unpacked Size

2.07 MB

Total Files

13

Last publish

Collaborators

  • ej-shafran