Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including react-text-collapse with all npm packages installed. Try it out:

require("react/package.json"); // react is a peer dependency. require("react-motion/package.json"); // react-motion is a peer dependency. var reactTextCollapse = require("react-text-collapse")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

react-text-collapse v0.5.2

React text collapse expand tool

React text collapse

NPM Version

Coverage Status

Build Status

Downloads

Dependency Status

License

React text collapse

Philosophy

Keep things simple! You don't need jQuery...

Installation

Join the chat at https://gitter.im/cht8687/react-text-collapse

npm

$ npm install --save react-text-collapse

Demo

Demo

Example code

Code Example

Usage

<ReactTextCollapse options={TEXT_COLLAPSE_OPTIONS}>
  <p>
    React text collapse is awesome. React text collapse is awesome.<br />
    React text collapse is awesome. React text collapse is awesome.<br />
    React text collapse is awesome. React text collapse is awesome.<br />
    React text collapse is awesome. React text collapse is awesome.<br />
  </p>
</ReactTextCollapse>

Options

options: PropTypes.object.isRequired

const TEXT_COLLAPSE_OPTIONS = {
  collapse: false, // default state when component rendered
  collapseText: '... show more', // text to show when collapsed
  expandText: 'show less', // text to show when expanded
  minHeight: 100, // component height when closed
  maxHeight: 250 // expanded to
  textStyle: { // pass the css for the collapseText and expandText here
    color: "blue",
    fontSize: "20px"
  }
}

Development

$ git clone git@github.com:cht8687/react-text-collapse.git
$ cd react-text-collapse
$ npm install
$ webpack-dev-server

Then

open http://localhost:8080/webpack-dev-server/

License

MIT

js-standard-style

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free