Sheet

A panel that slides in from an edge of the screen.

Usage

Like Dialog: put it inside a Layer, with a Header, a Sheet.Body that scrolls and a Sheet.Footer.

tsx
const { close, id, isActive, open } = useGraftDialog<void>();

<Layer open={isActive} onClose={close} aria-labelledby={id}>
  <Sheet placement="right">
    <Header className="border-b-margo border-border">
      <Header.Title id={id}>Filters</Header.Title>
      <Header.Trailing>
        <Button aria-label="close" onClick={close}>
          <Button.Icon><MdClose /></Button.Icon>
        </Button>
      </Header.Trailing>
    </Header>
    <Sheet.Body>…</Sheet.Body>
    <Sheet.Footer>
      <Button onClick={close}>
        <Button.Label>apply</Button.Label>
      </Button>
    </Sheet.Footer>
  </Sheet>
</Layer>

Placement

placement
rightthe default: full height, up to 26rem wide
leftfull height, up to 26rem wide
topfull width, up to 40% of the height
bottomfull width, up to 40% of the height

Size

tsx
<Sheet placement="right" className="max-w-[40rem]" />

<Sheet placement="bottom" className="max-h-[60%] rounded-t-margo-base" />

Reference

proptypedefault
as?ElementType"div"the element or component to render
placement?"top" | "right" | "bottom" | "left""right"the edge it slides in from
className?string—added after the component's own class: what you set wins
…restprops of as—typed against the chosen element