0.1.0 • Published 2 years ago

react-advanced-ellipsis v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React advanced ellipsis

Truncate string where you want and keep it's tail.

Original phrase:

I don't love ellipsis

Default ellipsis:

I don't love ellip...

Advanced ellipsis:

I do... love ellipsis

How to use

import { TailedEllipsis } from "react-advanced-ellipsis";

<TailedEllipsis tailLength={13}>I don't love ellipsis</TailedEllipsis>;

Props:

PropDescription
children: stringText to be truncated
tailLength: numberLength of a non shrinking tail
title?: stringText title
className?: stringText container className

NOTE: the library uses ResizeObserver inside. You may need a polyfill for some old browsers.

How to build the library

npm install
npm run build

It will produce artifacts into dist folder

How to run storybook

npm run storybook