@konforti/react-truncate

1.1.0 • Public • Published

✂️ React Truncate

React wrapper for @konforti/truncate

Features

  • Truncate text by number of lines.
  • Truncate form end, start or middle.
  • Responsive truncation.
  • Get notified if a text has been truncated or not.
  • Custom ellipsis.

🔧 Installation

npm i -S @konforti/react-truncate
yarn add @konforti/react-truncate

🔧 Usage

import Truncate from '@konforti/react-truncate';

🔦 Examples

<Truncate truncFrom="middle">{text}</Truncate>
<Truncate lines={3}>{text}</Truncate>
<Truncate ellipsis=">>> " truncFrom="start">
    {text}
</Truncate>
<Truncate
    onTruncate={truncated => {
        if (truncated) {
            setState({ truncated: true });
        }
    }}
>
    {text}
</Truncate>

Package Sidebar

Install

npm i @konforti/react-truncate

Weekly Downloads

19

Version

1.1.0

License

MIT

Unpacked Size

272 kB

Total Files

22

Last publish

Collaborators

  • konforti