1.0.5 • Published 3 years ago

@sstraatemans/react-readmore v1.0.5

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

Install

$ npm install react-readmore --save-dev

Test

You can test the functionality of the app by going to
https://react-read-more.sstraatemans.vercel.app/

Usage


Basic

import ReadMore from 'react-readmore';
const App: React.FC = () => {
    return <ReadMore maxLines="{3}">Lorem ipsum dolor sit amet, consectetur...</ReadMore>;
};

Style button

import ReadMore from 'react-readmore';
const App: React.FC = () => {
    return (
        <ReadMore maxLines="{3}" buttonClassName="class-name">
            Lorem ipsum dolor sit amet, consectetur...
        </ReadMore>
    );
};

overwrite ellipsis

import ReadMore from 'react-readmore';
const App: React.FC = () => {
    return (
        <ReadMore maxLines="{3}" ellipsis="***">
            Lorem ipsum dolor sit amet, consectetur...
        </ReadMore>
    );
};

overwrite label names

import ReadMore from 'react-readmore';
const App: React.FC = () => {
    return (
        <ReadMore maxLines="{3}" readMoreLabel="Lees meer" readLessLabel="Lees minder">
            Lorem ipsum dolor sit amet, consectetur...
        </ReadMore>
    );
};

Parameters

NameDescriptionTypeDefault value
maxCharactersthe max. amount of characters before truncatenumbernull
maxLinesthe max. amount of lines before truncatenumbernull
maxWordsthe max. amount of words before truncatenumbernull
ellipsisthe ellipsisstring...
readMoreLabelthe label of the read more buttonstringread more
readLessLabelthe label of the read less buttonstringread less
buttonClassNamethe classname to style the buttonstringnull

Either MaxWords, MaxCharacters or MaxLines is mandatory

License

react-readmore is licensed under the MIT license.

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago