1.0.2 • Published 7 years ago

react-readmore v1.0.2

Weekly downloads
53
License
WTFPL
Repository
github
Last release
7 years ago

Expand / collapse, component automatically calculates desired height

Props

All props are optional

**Default Props**

collapseText:'Read Less',
expandText:'Read More',
minHeight:'50px',
animation:'1s ease',
className:'react-openclose'
PropWhatDefault
collapseTextText shown in expanded stateRead Less
expandTextText shown in collapsed stateRead More
minHeightHeight in collapsed state50px
animationCss syntax animation prop1s ease
classNameComponent ClassName¹react-openclose

**CSS (¹)**

Im not going to assume how your CSS loaders are setup; So style implimentation is up to you, but see below for class names.

react-openclose__wrapper : react always needs a container
react-openclose : content conainer
react-openclose--open : open state on container
react-openclose--closed  : open state on container
react-openclose__button : the button

Minimal Example

import ReadMore = from 'react-readmore';

// ...etc

  render() {
    return (
      <ReadMore minHeight="52px" animation="1.2s ease">
        <p>Some <strong>Content</strong>. Obviously, make this more than 52px high worth of content</p>
      </ReadMore>
    );
  }

// ...etc