Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

node

Core widget-table constructor used by every zui widget. Returned tables are interoperable with hand-written widget trees, so user-built widgets can reuse the exact same primitive without depending on the rest of zui.

Exports

  • node(widgetType: string, opts: Opts?, children: any?) -> any — build the widget table. Returned directly by the module.

Types:

  • Opts = { id?: string, classes?: any, class?: any, props?: any, style?: any }

Usage

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

-- User-built widget composed on top of node:
return function(text, opts)
    return node("label", { props = { text = text } })
end

Notes

  • Accepts either a single child table or an array of children; single children are wrapped automatically (matches scroll.module's fix from #2331).
  • classes may be a string (space-separated) or an array — both normalise to an array of class names.
  • class is accepted as an alias for classes for ergonomic call sites.
  • Returning a function (not a table) keeps consumers terse and avoids callers needing to know whether the constructor lives on M.x or the module itself.