Forms overview
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.
Shared field API
Section titled “Shared field API”All field builders extend FormComponent:
Common methods
| Method | Description |
|---|---|
.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.