0.2.7 • Published 4 years ago

react-pretty-drawer v0.2.7

Weekly downloads
24
License
MIT
Repository
github
Last release
4 years ago

⚛️ react-pretty-drawer

Simple and pretty React drawer component. View demo

📦 Install

The easiest way to use react-pretty-drawer is to install it from npm and include it in your React build process

$ npm install --save react-pretty-drawer

$ yarn add react-pretty-drawer

Features

  • Open-close animation
  • Closable dialog
  • Available for customization

Usage

import React, {useState} from 'react';
import * as ReactDOM from "react-dom";
import {Drawer} from 'react-pretty-drawer';

const Example = () => {
    let [visible, setIsVisible] = useState(false);

    const closeDrawer = () => setIsVisible(false);
    const openDrawer = () => setIsVisible(true);

    return (
        <>
            <Drawer
                visible={visible}
                onClose={closeDrawer}
            >
                <div>Drawer body</div>
            </Drawer>
            <button onClick={openDrawer}>Open</button>
        </>
    );
};

ReactDOM.render(<Example />, document.getElementById("root"));

API

PropsDescriptionTypeDefault
closableWhether show or not the close button on top right of the Drawer dialogbooleanfalse
maskWhether to show mask or notbooleantrue
maskStyleStyle for Drawer`s mask | object | rgba(0, 0, 0, 0.3)
visibleWhether the Drawer dialog is visible or notbooleanfalse
heightHeight of the Drawer dialogstring number256px 100%
widthWidth of the Drawer dialogstring number256px 100%
placementThe placement of the Drawer'top' 'right' 'bottom' 'left''left'
onCloseSpecify a callback that will be called when a user clicks mask or close buttonfunction-
zIndexThe z-index of the Drawer.number1000
styleThe style of the body wrapper.object-
classNameThe class of the body wrapper.string-

License

MIT

0.2.7

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.1

5 years ago