react-toolbox/components/drawer
Lucas Nascimento b381db4054 Fix compatibility with typescript 2.4+ (#1615)
* Added a generic props interface to share with other components

* use the new DrawerCommonProps interface

* use the new DrawerCommonProps interface

* Fix compatibility with Typescript 2.3+
2017-09-21 00:16:38 +02:00
..
Drawer.d.ts Fix compatibility with typescript 2.4+ (#1615) 2017-09-21 00:16:38 +02:00
Drawer.js Importing PropTypes from prop-types rather than react (#1413) 2017-04-17 16:14:17 +02:00
config.css solve #1444 and #1359. (#1587) 2017-08-02 18:13:48 +02:00
index.d.ts Restructure typescript definitions (#1114) 2017-01-18 08:37:37 +01:00
index.js Update dependencies and linter (#1180) 2017-01-26 18:05:32 +01:00
readme.md Migrate styles to PostCSS (#666) 2017-01-05 02:42:18 +01:00
theme.css Fixes #1127 2017-01-18 10:56:03 +01:00

readme.md

Drawer

The navigation drawer slides in from the left. It is a common pattern found in Google apps and follows the keylines and metrics for lists.

import Drawer from 'react-toolbox/lib/drawer';

class DrawerTest extends React.Component {
  state = {
    active: false
  };

  handleToggle = () => {
    this.setState({active: !this.state.active});
  };

  render () {
    return (
      <div>
        <Button label='Show Drawer' raised accent onClick={this.handleToggle} />
        <Drawer active={this.state.active} onOverlayClick={this.handleToggle}>
          <h5>This is your Drawer.</h5>
          <p>You can embed any content you want, for example a Menu.</p>
        </Drawer>
      </div>
    );
  }
}

If you want to provide a theme via context, the component key is RTDrawer.

Properties

Name Type Default Description
active Boolean false If true, the drawer will be visible.
className String '' Sets a class to give customized styles to the drawer.
insideTree Boolean false If true the Drawer is rendered inside the normal tree.
onOverlayClick Function Callback function to be invoked when the overlay is clicked.
type String left Type of drawer. It can be left or right to display the drawer on the left or right side of the screen.
withOverlay String true If true display an Overlay that locks the scroll when the Drawer is active.

Theme

Name Description
active Used for the root class when the drawer is active.
content Used for the drawer content.
drawer Root class.
left Added to the root class when drawer is to the left.
right Added to the root class when drawer is to the right.
wrapper A wrapper class for the top of the root.