Drawer
Drawer slides a panel in from the side of the screen, over a scrim. Open it,
then press Escape, click the scrim, or press Close:
import { Heading } from '@hozo/core'import { Button, Drawer } from '@hozo/ui'import { useState } from 'react'
export function DrawerDemo() { const [open, setOpen] = useState(false) return ( <> <Button tone="neutral" onPress={() => setOpen(true)}> Open navigation </Button> <Drawer open={open} onClose={() => setOpen(false)} accessibilityLabel="Navigation"> <Heading level={3} className="text-lg font-bold text-hozo-text"> Navigation </Heading> <Button tone="quiet" size="sm" href="#overview"> Overview </Button> <Button tone="quiet" size="sm" href="#reports"> Reports </Button> <Button tone="quiet" size="sm" href="#settings"> Settings </Button> <Button tone="neutral" size="sm" onPress={() => setOpen(false)}> Close </Button> </Drawer> </> )}opendrives it, andonCloseis called when it asks to go away: Escape or the scrim. Keepopenin your state, as withDialog.- It is modal. Focus stays inside while it is open, the page behind it stops scrolling, and focus goes back to the opener when it closes.
sideisleftby default.startandendfollow the reading direction, sostartis the right-hand side in a right-to-left interface.accessibilityLabelnames it, oraccessibilityLabelledBypoints at a heading inside it.- There is no close button, for the reason
Dialoghas none: put one in the children, as the example does. - On React Native it is drawn over a
Modal, and a swipe toward the edge closes it.