Sheet
Sheet is a modal panel that slides in from a viewport edge — the mobile-first sibling of Modal. It is a bottom
sheet by default and a side drawer with placement="left" or "right". It dims the page, locks its scroll and
traps focus while open.When to use
- A secondary mobile flow needs the thumb-reachable bottom sheet: filters, pickers, details.
- A navigation or settings panel slides in from a side edge.
Usage
import { Sheet } from '@apollion-dsi/core/elements/sheet';
function Filters() {
const [open, setOpen] = useState(false);
return (
<>
<Button onClick={() => setOpen(true)} text="Filters" />
<Sheet isOpen={open} onDismiss={() => setOpen(false)} title="Filters">
<FilterForm />
</Sheet>
</>
);
}onDismiss fires on the overlay, the close button and Escape; the exit animation plays before the panel
unmounts. size sets the share along the slide axis: auto (content, capped at 84svh for bottom), half or
full (square-cornered takeover). The body scrolls inside the panel.
Adaptive presentation
From the md breakpoint up, a bottom sheet presents as a centered dialog with the Modal width. Portrait phones
keep the sheet; tablets and landscape phones get the dialog.
size | Mobile (sheet) | From md up (dialog) |
|---|---|---|
auto | content height, ≤ 84svh | content height, Modal base |
half | 50dvh | 50dvh, Modal base width |
full | full-screen takeover | 84svh, Modal large width |
The switch is a CSS min-width media query: same markup, no hydration flip, and resizing keeps focus and state.
adaptive={false} keeps the bottom sheet on every viewport. Side drawers ignore adaptive.
<Sheet isOpen={open} onDismiss={close} title="Now playing" adaptive={false}>
<Player />
</Sheet>Static mode
For static output with no client React, pass static and an id. The sheet renders as a closed native modal
<dialog>; the browser supplies the top layer, inert page, focus containment, Escape and focus return.
import { IconButton } from '@apollion-dsi/core/elements/icon-button';
import { getSheetTriggerProps, Sheet, SheetScript } from '@apollion-dsi/core/elements/sheet';
<IconButton label="Menu" icon={<Icon icon={menuBars} />} {...getSheetTriggerProps('site-menu')} />
<Sheet static id="site-menu" placement="right" aria-label="Menu">
<a href="#about" data-apollion-sheet-close="">About</a>
</Sheet>
<SheetScript /> {/* once per page, end of <body> */}getSheetTriggerProps(id)goes on a button. It emits the Invoker Commands pair (commandfor,command="show-modal"), the ARIA wiring and the fallback hook.data-apollion-sheet-closecloses the sheet from any element inside it, such as in-page links.SheetScript(orgetSheetScript()) is the fallback for browsers without Invoker Commands orclosedby="any". Without it, those browsers cannot open the sheet.isOpenandonDismissdo not apply; the types forbid mixing the modes.
Accessibility
role="dialog"witharia-modal="true", named bytitle; passaria-labelwhen there is no title.- Focus moves into the panel,
Tabwraps,EscapecallsonDismiss, and focus returns to the opener on close. closeLabelnames the close button (default'Fechar') — localize it.- A
Dropdown,Tooltip,PopoverorInputDateopened inside the sheet renders inside it, above the panel.
Properties
adaptivebooleantruearia-labelstringnonechildrenReactNodenonecloseLabelstringFecharid *stringnoneisOpenbooleannonenoCloseButtonbooleanfalseonDismiss(() => void)noneplacement"bottom""left""right"bottomsize"auto""half""full"autostaticbooleannonetitlestringnone