Builtin Library
README.md
input
Text input widget. Single-line by default; pass multiline = true
for a textarea. The code-editor variant (syntax-highlight, line
numbers, folding) lives in zui.widget.codeEditor — same underlying
widget kind, more defaults, plus the Luau highlighter producing
segments.
Exports
input(id: string, value: string?, opts: InputOpts?) -> WidgetNode— module returns the builder function directly.
Options forwarded to the node's props:
placeholder: string?onChange: string?— callback idsubmitOnEnter: boolean?multiline: boolean?password: boolean?codeEditor: boolean?segments: { Segment }?— pre-highlighted layout segmentsfoldLanguage: string?— opt into the Rust fold detector ("lua"etc.)lineNumbers: boolean?,folding: boolean?props,classes,style— standard widget plumbing.
Usage
local Z = require("@builtin::modules.zui")
Z.input("name", state.name, {
placeholder = "Your name",
onChange = "name:edit",
})
-- Multiline:
Z.input("notes", state.notes, { multiline = true })
Notes
- When
props.segmentsis supplied, the renderer builds the LayoutJob from segments instead of the plaintextstring — buttextis still set, so the underlying value continues to work for callbacks. - For syntax-highlighted code editing, prefer
Z.codeEditor, which bundlesfoldLanguage,lineNumbers,folding, and a default highlighter call. - Stateless — the parent owns the buffer; this widget only renders.