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

react-simple-show-more

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-simple-show-more

Simple Show More Component for React

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

React Simple Show More

npm package

Demo: https://elated-curran-7104e4.netlify.com/

Very simple and lightweight Show More feature.

It is in alpha testing. Please make an issue if you have any suggestion or feature request.

Table of contents

Installation

npm i react-simple-show-more

Overview

Very simple Show more feature.
This package guarantees you not to collapse in middle of the word.
For example: with length 23 = "I just want to say Hello" => "I just want to say" (not "I just want to say Hell")

Usage

Super easy to use:

import ShowMore from "react-simple-show-more"

class YourComponent extends Component {
  render() {
    return (
      <ShowMore
        text="Very long text"
      />
    );
  }
}

You can also configure it as your demand:

import ShowMore from "react-simple-show-more"

class YourComponent extends Component {
  render() {
    return (
      <ShowMore
        text="Very long text"
        length={170}
        showMoreLabel=" Expand"
        showLessLabel=" Collapse"
        tag="a"
        className="text-blue"
        ellipsis="..."
        style={{
          cursor: 'pointer',
          color: 'green',
          fontWeight: 'bold',
        }}
        enabled
      />
    );
  }
}

Demo

You can see demo via this https://elated-curran-7104e4.netlify.com/

Props

Parametervalueis requireddefault
textstringyes
lengthstring, numberno170
showMoreLabelstringno'Show more'
showLessLabelstringno'Show less'
tagstringno'span'
classNamestringno''
ellipsisstringno'...'
styleobjectnodefault Style
enabledbooleannotrue
defaultStyle = {
  cursor: 'pointer',
  color: '#007bff',
}

Contribution

All helps are welcome. Please open a PR and describe what do you want to improve.

Issues

Please create an issue at https://github.com/nvh95/react-simple-show-more/issues. I will spend time to help you.

Keywords

FAQs

Package last updated on 29 Nov 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