Giter Site home page Giter Site logo

react-pretty-drawer's Introduction

⚛️ 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

Props Description Type Default
closable Whether show or not the close button on top right of the Drawer dialog boolean false
mask Whether to show mask or not boolean true
maskStyle Style for Drawer`s mask object rgba(0, 0, 0, 0.3)
visible Whether the Drawer dialog is visible or not boolean false
height Height of the Drawer dialog string number 256px 100%
width Width of the Drawer dialog string number 256px 100%
placement The placement of the Drawer 'top' 'right' 'bottom' 'left' 'left'
onClose Specify a callback that will be called when a user clicks mask or close button function -
zIndex The z-index of the Drawer. number 1000
style The style of the body wrapper. object -
className The class of the body wrapper. string -

License

MIT

react-pretty-drawer's People

Contributors

shilza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

stshepana

react-pretty-drawer's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.