3.0.0 • Published 4 years ago

react-text-trimmer v3.0.0

Weekly downloads
13
License
MIT
Repository
github
Last release
4 years ago

react-text-trimmer

NPM version mdedys dependencies Status devDependencies Status peerDependencies Status

Installation

Install from NPM:

yarn install react-text-trimmer

Usage

Options

lines: number of lines to truncate text

prefix: prefix to attach to beginning of text, default is empty string

suffix: suffix to attach to end of text, default is ...

interval: dobounce interval, default is 166

There is two ways to use the text trimmer. One can use the component or the react hook.

Components

Props:

options: TextTrimmerOptions

import TextTrimmer from "react-text-trimmer"

...
<TextTrimmer>
  Long text.........
<TextTrimmer>

...

Hook

import { useTextTrimmer } from "react-text-trimmer"

...
const ref = React.useRef(null)

const value = useTextTrimmer(text, ref, options)

return <div ref={ref}>{value}</div>

...

Code Style

This repository is configured with EditorConfig.

3.0.0

4 years ago

3.0.0-rc2

4 years ago

3.0.0-rc3

4 years ago

3.0.0-rc1

4 years ago

2.0.0

6 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago