Dialog

@sushindustries/ui

A native dialog driven by props: top layer, focus trap and Escape from the element, click-outside from here.

5 min read
View as MarkdownEdit on GitHub

Props

PropTypeDefaultDoes
openboolean-Calls showModal, so the page behind goes inert while it is true.
onClose() => void-Escape, the backdrop and the close button all arrive here. Clear open or the two disagree.
titlestring-
childrenReactNode-
footer?ReactNode-Usually a Button row.

Notes

onClose is called, never assumed - clicking the backdrop, pressing Escape and pressing the close button all route through it, and none of them touch open directly. Keeping open in sync with onClose is the caller's job; see Guides for what happens when it is not.

footer is optional and, when absent, leaves no empty row behind - there is no placeholder bar rendered for a dialog with nothing to put in one.

UsesIconIconThe glyph set, generated from a Markdown table where every drawing carries its reason. One component, typed names, no icon font.@sushindustries/ui · content