Builtin Library
README.md
modal
Top-layer modal dialog with backdrop dim, click-outside + Escape
dismissal. Wraps egui::Modal (added 0.30, refined through 0.34).
Root-only — the render arm dispatches at the screen-root path, like
Window. Pass dismissible = false to force a button-only answer.
Exports
modal(opts: Opts?) -> any— build the modal widget node. Returned directly by the module.
Types:
Opts = { id?, title?, open?, onClose?, dismissible?, focusable?, tooltip?, children?, props?, style? }
Usage
local modal = require("@builtin::modules.zui.widget.modal")
local widget = modal({
title = "Confirm",
open = state.dialogOpen,
onClose = "dialog:close",
children = {
Z.lbl("Are you sure?"),
Z.hbox({
Z.btn("Yes", "dialog:yes"),
Z.btn("No", "dialog:no"),
}),
},
})
Notes
- Known limitation (pending Wave 5 / #2416): Tab navigation isn't trapped inside the modal — keyboard focus can still reach widgets behind the backdrop. The visible "this is modal" contract is otherwise complete.
- Must render at the screen root for the backdrop to cover the whole
surface; nesting inside a
panelwill clip the dim layer. dismissible = falseis the right choice for confirm dialogs whose answer affects irreversible state.