Field types
The fields config maps the name a form stores to the class behind it:
'fields' => [
'text' => Fields\TextInputField::class,
'email' => Fields\EmailField::class,
// ...
'postcode' => App\Forms\PostcodeField::class,
],Stored forms only know the name, so a field class can be renamed, moved or swapped for a project's own subclass by changing its entry here. Add an entry to offer a field type of your own in the builder's palette.
A text answer is at most max_length.text characters (1000), a text area
max_length.textarea (20000); null lifts the limit. An upload has to be one
of uploads.extensions, judged by its content rather than its name, and the
file picker offers only those; null takes any file.
A field can limit what a visitor may answer. An editor sets the limits under
"Validation" in the field's slide-over, a field in code with the setters
below, as in NumberField::make('bedrag')->min(1)->max(500)->decimals(2). The
server checks them, and the browser gets the same ones where HTML has an
attribute for them:
| Field | Limits | In code | In the browser |
|---|---|---|---|
| Text, text area | The fewest and the most characters, never past max_length | minLength(), maxLength() | minlength, maxlength |
| Number | A minimum, a maximum, and decimals: without them only whole numbers | min(), max(), decimals() | min, max, step |
| Date | An earliest and a latest date, each a fixed one, today, or the stricter | minDate(), maxDate(), notInPast(), notInFuture() | min, max |
| Checkboxes | The fewest and the most choices | minItems(), maxItems() | None, the server only |
| Upload | Fewer file types than uploads.extensions, smaller files than uploads.max_size, and with multiple uploads fewer files than uploads.max_files (10) | extensions(), maxSize(), maxFiles() | accept |
A limit only counts for an answer that is given, so an optional field may stay
empty. "Today", for a date that may not be in the past or in the future, is the
day in the app's app.timezone: on UTC that runs an hour or two behind the
Netherlands around midnight. Every setter has a getter, such as getMin(),
getMaxLength() or getMinDate(), for a front end of your own. A field type
of your own offers its settings under "Validation" by returning them from
getValidationFields(), and turns them into rules in fieldRules().
Besides text, email, phone, number, choices and uploads there is a date,
stored as the date input sends it (2026-10-07) and shown in the format the
editor picks (7 October 2026, 07-10-2026, 7 Oct 2026 or 2026-10-07),
and a consent: a box that is always required and never ticked in advance,
beside a text whose links open the terms in a new tab. Only links, bold and
italic survive in that text. Its optional name ("Privacy") heads its column,
and without one the text itself does.
A field type that returns false from isAvailable() stays out of the palette,
while a field of that type already on a form stays there. reCAPTCHA and
Turnstile do so until they are enabled with a key and a secret, see
Spam.
Settings every field should have, such as a CSS class for a project's own views, go on the plugin too. They show under "Other" on the Advanced tab of a field's slide-over, or above the preview for a field without one, and are kept on the field. The closure gets the field type's class:
FilamentFormBuilderPlugin::make()
->fieldSettings(fn (string $type): array => $type::isInput()
? [TextInput::make('css_class')->label('CSS class')]
: []);Read them as $field->getSetting('css_class'); a field in code sets them with
->settings(['css_class' => 'wide']).
A field type that stores more than one value, such as a branch picker that
also keeps the branch's name and email address, lists them all in
getSubmissionColumns() so each gets a label and a column. Only the keys in
getInputKeys(), the field's own key unless it says otherwise, are taken from
what the visitor posts; the other columns are for the field or its form type's
beforeStore() to fill in.
