Usage
DrawerHost from @prepared911/ui/blocks/drawer-host is the app drawer a shell mounts once. The shell owns whether it is open and which id it shows. The host renders that one drawer, swaps the content when the id changes, and can show a nav strip under the header.
Use it where a shell used to mount DrawerPortal and drive several drawers through useDrawerStore from @prepared911/ui-drawer. A single panel that is not the shared app drawer still uses Drawer. A record with an unsaved-changes guard uses DetailDrawer.
drawer search param stays on the shell route. Pass open and drawerId, or pass a store the shell created with createDrawerHostStore.nav on the drawer entry. The host renders the same segmented strip as DrawerNav.DetailDrawer.FormLayoutDrawer.drawer search param. They ask the shell, and the shell updates the host.Pass open, drawerId, and onOpenChange, or pass store. Do not pass both. createDrawerHostStore returns a new store each call. The shell holds it. The package does not keep a shared store, so two copies of the package do not share open state.
Changing drawerId while open is true replaces the header and the body in the same dialog.
Escape closes the drawer and focus returns to trigger. Open it from a row and omit trigger: focus returns to the element that was focused before the drawer opened.
On this page