How to use
The base field is an abstract class that provides some useful methods to all the other fields that extend it.
Available methods
__construct(?string $label = null, ?string $attribute = null)
Construct the field with the given label and attribute. The value of the field will be available in the Baggage by using the attribute as a key.
If the attribute is omitted, it will be automatically generated by running Str::identifier()
on the label you provided.
Field::make('Full name', 'fullname')
label(?string $label): static
Set the field's label
Field::make() ->label('Full name')
attribute(?string $attribute): static
Set the field's attribute
Field::make() ->attribute('fullname')
help(?string $markdown): static
Set the field's help text. Markdown compatible.
Field::make() ->help('If left empty, the slug will be _auto-generated_ based on the title.')
placeholder(?string $placeholder): static
Set the field's placeholder text.
Field::make() ->placeholder('Select a timezone')
rules(callable|array|string|ValidationRule $rules): static
Set the validation rules. Please refer to the Laravel documentation for the available validation rules.
Field::make() ->rules(['email', 'required']),
width(int $columns): static
Set the width (column count) for the current field. The value must be an int between 1 and 12.
// Displays two fields side-by-side, as their combined widths equal 12. Field::make()->width(6), Field::make()->width(6)
default(mixed $value): static
Set the field's default value.
Field::make()->default(now()),
setValue(mixed $value): static
Set the field's value.
Field::make()->setValue('GMT+10'),
onlyOn(string|array $flows): static
Only display the field on specific flows.
Field::make()->onlyOn('draft'),
hideOn(string|array $flows): static
Hide the field on specific flows.
Field::make()->hideOn('draft'),
hidden(bool $hidden = true): static
Hide the field
Field::make()->hidden(),
Inherited methods
The base field extends the base component and inherits all of its methods.