Form
Form offers a developer-friendly and organized approach to designing forms with built-in validation.

Usage Example
n.form(
{
id = "form",
submit_key = "<S-CR>",
on_submit = function(is_valid)
print(is_valid)
end,
},
n.text_input({
autofocus = true,
autoresize = true,
size = 1,
border_label = "Title",
max_lines = 5,
validate = n.validator.min_length(3),
}),
n.text_input({
flex = 1,
border_label = "Description",
validate = n.validator.compose(n.validator.min_length(4), n.validator.max_length(20)),
})
)Properties
on_submit
Default value
fn.ignoreType
fun(is_valid: boolean): nilsubmit_key
Default value
<C-CR>Type
string[] | stringValidators
PRs with new validators are welcome!
Available validation functions:
min_lengthmax_lengthequalscontains
Available combinators:
all: ensures all validators passany: ensures at least one validator passesnone: ensures no validators passcompose: alias forall