Skip to content
Shamar

Forms overview

All field types on one page — `/demo/form-components`.
static form(form: FormBuilder) {
return form.schema([
Section.make('Basics').schema([
TextInput.make('name').required(),
]),
])
}

Resources declare a form() builder. The Adonis host renders create/edit, hydrates payloads via the field registry, and validates required fields.

All field builders extend FormComponent:

Common methods

MethodDescription
.label(text)Field label in the UI.
.required()Mark required on create/edit.
.helperText(text)Help text below the control.
.default(value)Default state when creating a record.
.hiddenOnForm() / .hiddenOnDetail()Hide on create/edit or show view.
.columnSpan(n) / .columnSpanFull()Grid span inside Section/Grid layouts.
.live()Re-render the form when this field changes.

Browse each field type in the sidebar, or see Schema layouts.