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 | |
|---|---|
right | the default: full height, up to 26rem wide |
left | full height, up to 26rem wide |
top | full width, up to 40% of the height |
bottom | full 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
| prop | type | default | |
|---|---|---|---|
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 |
…rest | props of as | — | typed against the chosen element |
Sheet.Body and Sheet.Footer
| prop | type | default | |
|---|---|---|---|
as? | ElementType | "div" | the element or component to render |
className? | string | — | added after the component's own class: what you set wins |
…rest | props of as | — | typed against the chosen element |