Skip to the content

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.
Overlays

When to use

Use when
  • A secondary mobile flow needs the thumb-reachable bottom sheet: filters, pickers, details.
  • A navigation or settings panel slides in from a side edge.
Avoid when
  • A destructive confirmation or a footer with actions is needed — use Modal.
  • The side panel must stay open while the page is used — that is layout (SideBarLayout), not an overlay.
  • The popup is non-modal (menu, hint) — use Dropdown or Popover.

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
Scrolls sideways inside the table. The page does not.

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-close closes the sheet from any element inside it, such as in-page links.
  • SheetScript (or getSheetScript()) is the fallback for browsers without Invoker Commands or closedby="any". Without it, those browsers cannot open the sheet.
  • isOpen and onDismiss do not apply; the types forbid mixing the modes.

Accessibility

  • role="dialog" with aria-modal="true", named by title; pass aria-label when there is no title.
  • Focus moves into the panel, Tab wraps, Escape calls onDismiss, and focus returns to the opener on close.
  • closeLabel names the close button (default 'Fechar') — localize it.
  • A Dropdown, Tooltip, Popover or InputDate opened inside the sheet renders inside it, above the panel.

Properties

See also