1.1.0 • Published 6 years ago

@konforti/react-truncate v1.1.0

Weekly downloads
42
License
MIT
Repository
-
Last release
6 years ago

✂️ 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>