Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

widget

Widget namespace — re-exports every widget under zui.widget.<name>. Library users can either pull the whole namespace (local W = require("modules.zui.widget"), then W.button(...)) or grab a single widget directly (local btn = require("modules.zui.widget.button")). Each widget lives in its own .module/ folder so authors adding a new widget edit exactly one file. The shared primitive every widget builds on is zui.widget.node — pulled into a user-defined widget the same way it's pulled in here.

Exports

This module is a namespace — every field is an assignment from the matching sibling module. No typed functions live here directly; the typed surface lives on each sibling.

  • M.node — core widget-table constructor (modules.zui.widget.node).
  • Content widgets: label, button, icon, iconBtn, iconButton, chip, badge, card, colorSwatch, dialogueBox, kbd, input, codeEditor, slider, dragValue, checkbox, toggle, dropdown, datePicker, radioGroup, selectableList, image, viewport, progressBar, richText.
  • DAW widgets: fader, knob, meter.
  • Game-HUD widgets: healthBar, hotbar, minimap.
  • Layout containers: hbox, vbox, grid, split, sides, panel, section, scroll, collapsible, window, modal, popup, contextMenu, scene, area, anchor, topPanel, bottomPanel, leftPanel, rightPanel, centralPanel.
  • Leafs: spacer, flex, sep.
  • Plot / Graph: plot, graph.
  • Drag-and-drop list: dndList.
  • Canvas: canvas.
  • Composite widgets: tabs, tree, filterRow, statRow, statusLabel.
  • Sub-namespaces: lsp, fs.

Usage

local W = require("@builtin::modules.zui.widget")

return W.vbox{
    W.label("Name:"),
    W.input(""),
    W.hbox{ W.button("Save", { onClick = "save" }), W.button("Cancel") },
}

-- Or pull single widgets directly:
local btn = require("@builtin::modules.zui.widget.button")
return btn("Save", { onClick = "save" })

Notes

  • The exposed M.node is the canonical primitive for user-defined widgets — require("modules.zui.widget.node") returns the same value.
  • Sub-namespaces (lsp, fs) collect tightly-coupled widget sets that only make sense together — isolating them keeps the top-level surface clean.
  • Plot and Graph are pure-Luau builders over canvas; no egui_plot dependency.
  • DndList composes per-row canvases + a transparent overlay canvas for drag-source detection and hover insertion indicators.
  • All re-exports are static — adding a new widget means adding a new M.<name> = require(...) line here (and creating the sibling module).