Builtin Library
README.md
inspector
Pre-built inspector pane — Z.shell.inspector { title, fields, actions }. Captures the form-with-fields-and-actions pattern every
editor reinvents. Field editors are auto-selected from the value type;
field.kind overrides (e.g. for color swatches or free-form int/float
inputs). The module returns the shell function directly.
Exports
inspectorShell(opts: InspectorOpts?) -> panel-widget— render an inspector pane from a title + fields/sections + action buttons.
Types:
InspectorField = { label?, value?, onChange?, readonly?, kind?, hint?, id?, min?, max?, minWidth? }InspectorAction = { label?, onClick?, variant? }—variant in "primary" | "secondary" | "danger".InspectorSection = { title?, fields?, defaultOpen?, id? }InspectorOpts = { id?, class?, classes?, title?, fields?, sections?, actions?, message? }
Usage
local inspectorShell = require("@builtin::modules.zui.shell.inspector")
inspectorShell {
title = "Entity",
fields = { { label = "x", value = 1, onChange = "x:set" } },
actions = { { label = "Apply", onClick = "apply", variant = "primary" } },
}
Notes
- Editor selection:
boolean→ checkbox,number→ slider (min/max default 0/1),kind = "int"|"float"→ free-form input,kind = "color"→ hex button swatch,string→ text input. Settingreadonly = truerenders a label regardless of type. sectionstakes precedence over a flatfieldslist — each section becomes a collapsible, expanded by default unlessdefaultOpen = false.- Actions render right-aligned in a row at the bottom. The
variantfield maps to theme tokens:primary→ accent,danger→ danger, anything else → panel_alt.