This package has been deprecated

Author message:

@WARNING: @WARNING: @WARNING: THIS PACKAGE IS NO LONGER MAINTAINED! Please consider using another package.

react-text-trail

1.0.1 • Public • Published

react-text-trail

Text trailing component for ReactJS.

Build Status


Source: https://github.com/trevorsenior/react-text-trail

Install: npm install --save react-text-trail

What is it?

Provides a component that contains text given to it. If that text is larger than the component, then it will add a trailing element to indicate that there is more content that is not visible.

Properties

  • text: What text should appear in this component?
  • endOnWord: Should we trail off after a complete word, or break mid-word? (default: false).
  • trail: A string (or component) to trail off with. By default '…'.
  • trailProps: Properties to pass into the trail if it's a component.

Usage

Basic

// Default
<TextTrail text="beep boop" />
// Trail off on a complete word
<TextTrail text="beep boop" endOnWord={true} />
// Use a custom trail string (instead of `'…'`)
<TextTrail text={text} trail="(>^_^)>" />

Advanced

You can provide your own trail component that will render at the end of the content. It can be a "more..." button / etc. It should render inline as it will sit at the end of the text.

For an example, view the example directory.

Example Preview

Package Sidebar

Install

npm i react-text-trail

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • akm8ihc78quzbfy
  • 7fs9jsaipnxzg2agkaegqgnbappcpw