0.0.1 • Published 11 months ago

@ui-stuff/react-drawer v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

react-drawer

React Drawer component

Install

npm install --save @ui-stuff/react-drawer

Usage

import {Drawer} from "@ui-stuff/react-drawer"
import {useState} from "react"

const App = () => {
    const [isOpen, setIsOpen] = useState(false)

    return (
        <>
            <button type={"button"} onClick={() => setIsOpen(true)}>Open</button>
            <Drawer isOpen={isOpen} onClose={() => setIsOpen(false)}>
                Some Content
            </Drawer>
        </>
    )
}

export default App

API

nametyperequireddefaultvaluedescription
childrenstringnoReactNodeContent of the drawer
isOpenbooleanyesfalsetrue | falseShow or hide the drawer
onClosefunctionyesany executable functionFunction called to close the drawer
positionstringno"right""right" | "left"Position of the drawer