term.widgets.form

term.widgets

form(content, opts) -> results, action

Display an interactive form dialog with labeled input fields

Opens a bordered dialog with one input field per label in content. The opts.meta table can specify per-field options like w (width) and secret (mask input). The opts.values table pre-fills fields (label to initial value), making the form usable for editing.

Returns a table mapping labels to values, plus an action string: "save" when confirmed with CTRL+s, "cancel" when dismissed with ESC. A cancelled form returns the initial values untouched, discarding any edits made in the dialog.