react-showhide-component

1.0.2 • Public • Published

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

Property Type Default Description
items string | array undefined Array of elements of string
minItems number undefined No of element(for array) / lines (for string) to show by default
mode string array 'array' or 'string'
viewMoreButton element
View More
View more button
viewLessButton element
View Less
View less button

License

MIT © https://github.com/vaibhavdiwani

Any help in improvement/optimization is very much appreciated

Package Sidebar

Install

npm i react-showhide-component

Weekly Downloads

4

Version

1.0.2

License

MIT

Unpacked Size

23.9 kB

Total Files

6

Last publish

Collaborators

  • vaibhav_patel