Drawer#

Github

Drawer​​ is a sliding side panel that emerges from the edge of the screen, commonly used to house auxiliary functions.

import { Drawer } from "wis/drawer"

API Reference#

NameTypeDefaultDescription
titlestringnoneDrawer header text, displayed at the top of the module.
descriptionstringnoneDrawer description text, displayed in the drawer header.
toggleTipReactNodenoneThe toggle tip.
sideright bottombottomConfigure the sliding direction of the Drawer from the screen edge.
sizenumbernoneConfigure drawer dimensions where the 'side' property determines measurement type: setting to 'bottom' specifies height, while 'right' defines width.
closeablebooleantrueSet whether to display the close icon in the Drawer.
maskCloseablebooleantrueEnable closing the Drawer by clicking the overlay mask.
modalbooleantrueConfigure whether the popup is in modal mode.
openbooleannoneControlled open state of the Drawer. Must be used with onOpen.
defaultOpenbooleannoneInitial open state of the Drawer when first rendered.
onOpen(open: boolean) => voidnoneEvent handler called when the Drawer's open state changes.

Method#

import { useRef } from "react" import { Drawer, type DrawerRef } from "wis/drawer" import { Button } from "wis/button" function () { const drawer = useRef<DrawerRef>(null); return ( <> <Button text="Open" onClick={() => drawer.current?.show()} /> <Drawer ref={drawer} title="Drawer Title" /> </> ) }

Type Definition

interface DrawerRef { show: () => void; hide: () => void; }

show(): void#

show Drawer

hide(): void#

hide Drawer