1.0.2 • Published 6 years ago

react-showhide-component v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

react-showhide-component

NPM JavaScript Style Guide

Install

Using npm:

npm install --save react-showhide-component

or using yarn:

yarn add react-showhide-component

Usage

import React, { Component } from 'react'

import ReactShowHideComponent from 'react-showhide-component'

const arr = [1, 2, 3, 4, 5];

export default class Example extends Component {
  render() {
    const listHtml = arr.map((elem, i) => {
      return <div key={i}>{elem}</div>;
    });
    return <ReactShowHideComponent items={listHtml} minItems={2} />;
  }
}

Props

PropertyTypeDefaultDescription
itemsstring | arrayundefinedArray of elements of string
minItemsnumberundefinedNo of element(for array) / lines (for string) to show by default
modestringarray'array' or 'string'
viewMoreButtonelementView MoreView more button
viewLessButtonelementView LessView less button

License

MIT © https://github.com/vaibhavdiwani

Any help in improvement/optimization is very much appreciated