react-collapse-transition

0.0.2 • Public • Published

CollapseTransition

React collapse transition componnet.

Install

npm i react-collapse-transition

Usage

import React, { Component } from 'react'
import CollapseTransition from 'react-collapse-transition'
 
class Demo extends Component {
  state = {
    visible: true
  }
 
  toggle = () => {
    this.setState(state => {
      state.visible = !state.visible
      return state
    })
  }
 
  render() {
    return (
      <div className="menu">
        <p className="menu-title" onClick={this.toggle}>
          title
        </p>
        <CollapseTransition visible={this.state.visible}>
          <div className="menu-content">
            <p>content...</p>
            <p>content...</p>
            <p>content...</p>
            <p>content...</p>
            <p>content...</p>
          </div>
        </CollapseTransition>
      </div>
    )
  }
}

The result would be like:

react-collapse-transition

LICENSE

MIT

Package Sidebar

Install

npm i react-collapse-transition

Weekly Downloads

6

Version

0.0.2

License

MIT

Unpacked Size

9.49 kB

Total Files

5

Last publish

Collaborators

  • justemit