-
Notifications
You must be signed in to change notification settings - Fork 0
Field Options
Sets the default value to use for the field. $default = The default value.
Field::make('City')->input()->default('Toronto'),
Sets the autocomplete value to use for the field. $autocomplete = The autocomplete value.
Field::make('Password')->input('password')->autocomplete('new-password'),
Sets the placeholder value to use for the field. $placeholder = The placeholder value.
Field::make('Country')->input()->placeholder('What country do you live in?'),
Sets the help text to use below the field. $help = The help text.
Field::make('City')->input()->help('Please enter your current city.'),
Set a custom text to be displayed instead of the default message on validation errors. $message = The custom validation message.
Field::make('City')->input()->help('Please enter your current city.'),
Sets the prefix text displayed in front of the field, with a gray background. $prefix = The prefix text.
Field::make('Url')->input('url')->prefix('https://'),
icon($icon) see Icons page->
Sets the icon displayed in front of the field, with a gray background. $icon = The path to the svg icon. (The icon is placed before prefix if both are applied.)
Field::make('Url')->input('url')->icon('light/globe'),
Available for inputs of type number, range, date, datetime-local, month, time, week See the documentation for Range slider
Sets a custom view to use for the field. Useful for more complex field elements not included in the package. $view = The custom view.
Example custom view file:
{{-- fields/custom-field.blade.php --}}
<div class="form-group row">
<label for="{{ $field->name }}" class="col-md-2 col-form-label text-md-right">
{{ $field->label }}
</label>
<div class="col-md">
<input
id="{{ $field->name }}"
type="text"
class="custom-field-class form-control @error($field->key) is-invalid @enderror"
wire:model.lazy="{{ $field->key }}">
@include('tall-forms::fields.error-help')
</div>
</div>
Custom views are passed $field, $form_data, and $model variables, as well as any other public component properties.
Example custom view field declaration:
Field::make('Custom Field')->view('fields.custom-field');