1.1.4 • Published 6 years ago

react-classic-drawer v1.1.4

Weekly downloads
25
License
-
Repository
github
Last release
6 years ago

react-classic-drawer

A classic and simple implement of react drawer;

Note: Your React version should be at least 16+!

install

npm install react-classic-drawer react-addons-css-transition-group --save

example

https://johnsnow93.github.io/react-classic-drawer/

usage

import Drawer from 'react-classic-drawer';
import 'react-classic-drawer/build/style.css'

class App extends React.Component {
  constructor(props){
    super(props);
    this.state = {
      visible: false,
    }
  }

  render() {
    return (
      <div>
        <button onClick={()=>{ this.setState({ visible: true }) }}>open</button>
        <Drawer visible={this.state.visible} direction="LEFT">
          <h2>This is drawer's content</h2>
          <p>Just put content here as Drawer's children</p>
        </Drawer>
      </div>
    )
  }

}

API

React classic drawer as a component can receive props:

nametypedefaultdescription
visiblebooleanfalseset drawer open or close
directionenumstring'RIGHT'set drawer direction, one of 'LEFT','RIGHT','TOP','BOTTOM'
durationnumber500set milliseconds for animation when drawer open and close
onClosefunction--callback function on drawer close or mask layer is clicked
contentClassstring--set a classname for the wrapper of drawer content
1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago