Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-show-more

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-show-more

React component for truncating multi-line spans and adding an ellipsis

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

React Show More

NPM version Downloads Build status Coverage status Dependency status Dev dependency status

This is a convenience wrapper around react-truncate.

Install

$ npm install react-show-more

Usage

import ShowMore from 'react-show-more';

// ...

class Foo extends Component {
    render() {
        return (
            <ShowMore
                {* Default options *}
                lines={3}
                more='Show more'
                less='Show less'
                anchorClass=''
            >
                {longText}
            </ShowMore>
        );
    }
}

API

PropTypeDefaultDescriptionExample
linesinteger, boolean {false}3Specifies how many lines of text should be preserved until it gets truncated. false and any integer < 1 will result in the text not getting clipped at all.(false, -1, 0), 1, ...
childrenstring, React nodeThe text to be truncated. Anything that can be evaluated as text.'Some text', <p>Some paragraph <a/>with other text-based inline elements<a></p>, <span>Some</span><span>siblings</span>
morestring, React node'Show more'The text to display in the anchor element to show more.'Show more', <span>Show more</span>
lessstring, React node'Show less'The text to display in the anchor element to show less.'Show less', <span>Show less</span>
anchorClassstring''Class name(s) to add to the anchor elements.'my-anchor-class', 'class-1 class-2'

Developing

Install development dependencies

$ npm install

Run tests

$ npm test

Run code linter

$ npm run lint

Compile to ES5 from /src to /lib

$ npm run compile

Keywords

FAQs

Package last updated on 16 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc