Builtin Library
README.md
dialogueBox
Narrative dialogue panel — speaker name + dialogue text + per-option
response buttons inside a styled panel. Built as a primitive
composition (panel + label + btn), so the engine has no dedicated
arm.
Exports
dialogueBox(opts: DialogueBoxOpts?) -> WidgetNode— build a dialogue widget node.
Types:
DialogueOption = { text?, enabled?, tooltip? }DialogueBoxOpts = { id?, speaker?, dialogue?, options?, bg?, border?, borderWidth?, padding?, gap? }
Usage
local dialogueBox = require("@builtin::modules.zui.widget.dialogueBox")
dialogueBox({
id = "dlg1",
speaker = "Captain",
dialogue = "We've got incoming. Pick your move.",
options = {
{ text = "Engage" },
{ text = "Retreat", enabled = false },
{ text = "Hail", enabled = true },
},
})
Notes
-
Each option emits a click event keyed
<id>-<index>(1-based), so a single pattern handler captures every response:app:on("^dlg1%-(%d+)$", function(_, _, idx) handleResponse(tonumber(idx)) end) -
When
opts.idis omitted, the callback prefix falls back to"dialogueBox". -
option.enableddefaults totrue(the wrapper checksoption.enabled ~= false). -
Styling defaults pull from
Theme.default(panel,border,text,text_bright).