1.0.4 • Published 2 years ago

@atul15r/react-drawer v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React Drawer

React Drawer is an animated Drawer component which is designed for react app.

Live Demo

Alt text

Installation

 # If you use npm:
 npm i @atul15r/react-drawer

 # If you use yarn:
 yarn add @atul15r/react-drawer


 ES6 Usage
 import { Drawer } from '@atul15r/react-drawer';

 Commonjs Usage
 var Drawer = require('@atul15r/react-drawer');

Quick Start

import React, {useState} from 'react';
import { Drawer } from '@atul15r/react-drawer';


const App = () => {
  const [show, setShow]=useState(false)
  const onToggle=()=>setShow(!show)

  return (
   <>
  <button onClick={onToggle}>Show Drawer</button>
  <Drawer
    show={show}
    onClose={onToggle}
   >
   Hello World
   </Drawer>
   </button>
  );
};

export default App;

Usage With Custom Styles

import React, {useState} from 'react';
import { Drawer } from '@atul15r/react-drawer';


const App = () => {
  const [show, setShow]=useState(false)
  const onToggle=()=>setShow(!show)

  return (
   <>
  <button onClick={onToggle}>Show Drawer</button>
  <Drawer
    show={show}
    onClose={onToggle}
    direction="right"
   >
   Hello World
   </Drawer>
   </button>
  );
};

export default App;

Props

nametyperequireddefaultdescription
showbooleantruefalsefalse - drawer close true - drawer open
onClosefuncfalsepass a func to toggle the drawer view
drawerStyleobjectfalsedrawerStyle= {{ background:#6b6b6b, }}
drawerClassNamestringfalseadd any custom class you want
widthstring | numberfalse350width will be effective only if the drawer position is left or right
heightstring | numberfalse350height will be effective only if the drawer position is top or bottom
directionleft | right | top | bottomfalseleftchange drawer position eg: direction="right"
backdrpstringfalsebackdrop color
1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago