input.module
This package holds more than this page lists. See all of its files in its world.
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?number: ("whole" | "decimal")?— the field takes a number: an on-screen keyboard shown for it (Android's number keyboard, a browser'sinputmode) is laid out for digits, with a decimal separator for"decimal".onChangereports the text as typed.signed: boolean?— withnumber, the number may be negative: the keyboard offers a minus sign.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 })
-- A price, typed on a phone's number keyboard:
Z.input("price", state.price, { number = "decimal", onChange = "price:edit" })
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.