CmouseG / react-sidebar-layout

Easy way to add side box

Home Page:https://fedorovsky.github.io/react-sidebar-layout/example/?selectedKind=My%20Component&selectedStory=Common&full=0&addons=0&stories=1&panelRight=0&addonPanel=REACT_STORYBOOK%2Freadme%2Fpanel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Usage

import Layout from 'react-layout-drawer';

<Layout>
    <Layout.Drawer>
        ...
    </Layout.Drawer>
    <Layout.Page>
        ...
    </Layout.Page>
</Layout>

Example View

Component features

If you need to open the box, you can use the context api. Context for the box is available inside on any nesting.

import Layout from 'react-layout-drawer';

<Layout.Consumer>
    {({ openDrawer, closeDrawer }) => (
        <div>
            <button onClick={openDrawer}>Open</button>
            <button onClick={closeDrawer}>Close</button>
        </div>
    )}
</Layout.Consumer>

Properties