react-drawer (1.3.4)
Simple HTML5 drawer menu for React.js.
Installation
The easiest way to use react-drawer is to install it from npm and include it in your React build process (using Webpack, Browserify, etc).
npm install --save react-drawer
Create a standalone module using WebPack:
> npm install
> webpack
Demo
https://jmfrancois.github.io/react-drawer/
Run on your local & development
// 1. keep monitor changes to /src/*> npm run build:watch// 2. open dev server> npm start// 3. visit http://localhost:3000/example/
Example
import React from 'react';import ReactDOM from 'react-dom';import ReactDrawer from 'react-drawer'; /* if you using webpack, should not apply identity to this css */import 'react-drawer/lib/react-drawer.css'; Component { ; thisstate = open: false position: 'right' noOverlay: false ; thistoggleDrawer = thistoggleDrawer; thiscloseDrawer = thiscloseDrawer; thisonDrawerClose = thisonDrawerClose; thissetPosition = thissetPosition; thissetNoOverlay = thissetNoOverlay; } { this; } { this; } { this; } { this; } { this; } { return <div> <div => <h1>React Drawer configuration</h1> <div => <label>Position</label> <select = => <option ="top">top</option> <option ="bottom">bottom</option> <option ="left">left</option> <option ="right">right</option> </select> </div> <div => <input ="checkbox" = = /> <label>No overlay</label> <small>The overlay lets you close the drawer on click</small> </div> <button = = = > !thisstateopen ? <span>show drawer</span>: <span>close drawer</span> </button> </div> <ReactDrawer = = = => <i = ="icono-cross"></i> <h2>What a nice drawer !</h2> </ReactDrawer> </div> ; } ReactDOM;
Todo
- basic features
- open position option
- drawer open method
- themes
License
MIT