This repository has been archived by the owner on Dec 29, 2021. It is now read-only.
generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Form DateField
Luca Longo edited this page Sep 11, 2020
·
6 revisions
Render an input field that allow date value(s), and display a calendar using Flatpickr.
name | type | default value | description |
---|---|---|---|
id | ?string | null | Field ID |
name | ?string | null | Field name |
label | ?string | null | Label visible on the form |
errorBag | ?string | null | Error field returned from the bag |
disabled | bool | false | Determs if the field is disable (or not) |
readOnly | bool | false | Determs if the field is read-only (or not) |
value | mixed | null | Field value |
placeholder | ?string | null | Field placeholder |
hint | ?string | null | Hint text shown above the form component |
help | ?string | null | Hint text shown after the form component |
valueFormat | ?string | null | Input form value |
displayFormat | ?string | null | Alternative value shown to the UI |
mode | ?string | null | Determs if the calendar will works as single value (default), range or multiple values. |
customConfig | ?array | null | Allow to extend the flatpickr with custom configurations |
<x-bc-form:date-field label="Date field" error-bag="dateField" value-format="Y-m-D" display-format="d/m/Y" />
If you use Laravel Livewire:
<x-bc-form:date-field label="Date field" error-bag="dateField" value-format="Y-m-D" display-format="d/m/Y" wire:model.lazy="moneyField" />
Finally, to show the time:
<x-bc-form:date-field label="Date Time field" error-bag="dateField" value-format="Y-m-D H:i" display-format="m/D/Y H:i" wire:model.lazy="moneyField" :custom-config="['enableTime' => true]" />
prepend
append
Example:
<x-bc-form:date-field>
<x-slot name="prepend">Prepend</x-slot>
<x-slot name="append">Append</x-slot>
</x-bc-form:date-field>