Open as a modal dialog. Focus returns to opener (default: the element focused now) on close,
which matters in Safari where clicking a button does not focus it.
showModal(opener)
Same as show(): Focsd dialogs are always modal.
requestClose(returnValue)
Ask to close: fires a cancelable cancel, then closes with returnValue unless it was canceled.
close(returnValue)
Close, optionally setting returnValue.
Events
Event
Description
cancel
Fired before a close request (Escape, backdrop, requestClose); cancel it to keep the dialog open.
close
Fired after the dialog closes; read returnValue for how it closed.
Slots
Slot
Description
(default)
Default content.
actions
The dialog's buttons.
CSS parts
Style the inside of the component with ::part(), for example focsd-drawer::part(actions).
Part
Description
actions
The actions element.
body
The body element.
close
The close (×) button, last in the tab order; it asks to close like Escape (hidden with `no-close`).
dialog
The dialog element.
headline
The headline element.
Accessibility
showModal(), requestClose() and closedby work as on focsd-dialog.
A modal dialog anchored to end (default), start or bottom, with the same focus behavior as focsd-dialog, including its close (×) button (no-close hides it).
The slide animation is off under reduced motion.
Keyboard
Key
Action
Escape
Closes
Ask the docs
Hi, what are you building?
Ask about any component, theming, forms or frameworks. I answer with the right component, a snippet and a link to its docs.