tsx
import { DrawerProvider } from "@arkyn/components";
tsx
<DrawerProvider><App /></DrawerProvider>
tsx
function DrawerActions() {const { openDrawer } = useDrawer();return (<><button onClick={() => openDrawer("navigation", { section: "main" })}>Open navigation</button><button onClick={() => openDrawer("filters", { category: "tech" })}>Open filters</button></>);}<DrawerProvider><DrawerActions /></DrawerProvider>;
useDrawer(key) is used, open/close actions are automatically scoped to that key.tsx
function FiltersDrawer() {const { drawerIsOpen, drawerData, closeDrawer } = useDrawer<{category: string;}>("filters");if (!drawerIsOpen) return null;return (<aside><p>Category: {drawerData?.category}</p><button onClick={closeDrawer}>Close</button></aside>);}
useDrawer hook must be called inside
DrawerProvider. Outside provider scope, it throws an error.children - ReactNode
React subtree that will receive drawer context.enableDrawerAutomation - boolean
Optional flag reserved for drawer automation behavior.