This component is a simple rewrite of the Shave library.
It allows you to add ellipsis to multi line text.
It doesn't make use of the real Shave library, everything has been re-implemented to
limit the access to the DOM directly to let React manage it.
The component is very small and concise, take a look in the /lib
folder. 🙂
Just a small demo of the component:
http://codepen.io/FezVrasta/pen/PGLVNO
npm install --save react-shave
or
yarn add react-shave
<Shave maxHeight={70}>
{someLongTextHere}
</Shave>
React Shave accepts few properties:
-
maxHeight
: required to know the desired max height of the component; -
tag
: by default isp
, but you can define any HTML block tag you prefer; -
character
: by default is ellipsis (…
) but you can define any string you prefer;