@gluedigital/read-more

0.1.1 • Public • Published

ReadMore

React component for collapsing and expanding a text

Usage

To install it:

npm install --save @gluedigital/read-more

To use it:

import ReadMore from '@gluedigital/read-more'

// ...

<ReadMore
  value={text}
  delimiter={'\n'}
  maxExcerptLength='250'
  messageReadMore={messageReadMore}
  messageReadLess={messageReadLess}
/>

Options

The following props can be used:

Name Type Description
value string Text that you want to show
delimiter string Characters that delimit how far the text collapses
maxExcerptLength string Default number by which the text will collapse if you do not find the delimiter
messageReadMore string Message displayed when the text is collapsed
messageReadLess string Message displayed when the text is expanded

Note The delimiter is replaced by a blank space when the text expands

Developing

This package uses nwb for the build. Take a look at their documentation for more info.

TL;DR: after installing nwb, just do npm start to open the dev environment.

Package Sidebar

Install

npm i @gluedigital/read-more

Weekly Downloads

8

Version

0.1.1

License

MIT

Unpacked Size

8.4 kB

Total Files

5

Last publish

Collaborators

  • linuxgunter
  • landesag
  • csar
  • mancontr
  • alex_bf
  • javibt