Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

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 id
  • submitOnEnter: boolean?
  • multiline: boolean?
  • password: boolean?
  • codeEditor: boolean?
  • segments: { Segment }? — pre-highlighted layout segments
  • foldLanguage: 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.segments is supplied, the renderer builds the LayoutJob from segments instead of the plain text string — but text is still set, so the underlying value continues to work for callbacks.
  • For syntax-highlighted code editing, prefer Z.codeEditor, which bundles foldLanguage, lineNumbers, folding, and a default highlighter call.
  • Stateless — the parent owns the buffer; this widget only renders.