Date picker
A field for picking a single day, time or month; it shows the browser's own picker in the kit's style.
zb:date-picker zubazar/ui-pro
This component is in Zubazar UI Pro; Zubazar UI Pro brings Zubazar UI with it. Installing Zubazar UI Pro →
Basic usage
value is always given as YYYY-MM-DD; on screen it follows the user's language (e.g. 10/07/2026).
<zb:date-picker name="delivery_date" label="Delivery date" value="2026-10-07" hint="The day emailed to the customer." />
| Prop | Values |
|---|---|
value | YYYY-MM-DD |
label, hint | Same as zb:input |
Types
Use type for date and time, time only or a month; each type's value format is in the table.
<zb:date-picker name="day" label="Day" value="2026-10-07" />
<zb:date-picker name="appointment" type="datetime-local" label="Appointment" value="2026-10-07T09:30" />
<zb:date-picker name="time" type="time" label="Time" value="09:30" />
<zb:date-picker name="period" type="month" label="Period" value="2026-10" />
| Prop | Values |
|---|---|
type | date | datetime-local | time | month |
value | YYYY-MM-DD · YYYY-MM-DDTHH:MM · HH:MM · YYYY-MM |
Earliest and latest date
min and max block the days outside the range; write them in the same format as value.
<zb:date-picker name="october_delivery" label="Delivery date" min="2026-10-01" max="2026-10-31" hint="Only a day in October 2026." />
| Prop | Values |
|---|---|
min | First value that can be picked |
max | Last value that can be picked |
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
label | — | null | Label above the field |
name | — | null | Field name; otherwise the wire:model value |
hint | — | null | Help text below |
type | — | date | date · datetime-local · time · month |
input-class | — | null | Classes of the <input> element itself (added to the calendar icon's classes) |
uiDateRangePicker: startDate, endDate | — | '' | Initially selected range (Y-m-d) |
uiDateRangePicker: minDate | — | null | First day that can be picked; 'today' closes past days |
uiDateRangePicker: disabledRanges | — | [] | Days that cannot be picked (flatpickr disable format) |
uiDateRangePicker: startProperty, endProperty | — | 'startDate', 'endDate' | Properties the selection is written to in the Livewire component |
uiDateRangePicker: date-range-picked | — | — | Event dispatched when the range is complete; detail: { start, end } (Y-m-d) |
Slots: Attributes such as value, min, max, required and disabled are added to the field through zb:input; class, style, x-show and wire:key go on the outer element that wraps the whole field.
Advanced
Date range
For a ready field use zb:date-range; for your own markup wrap the field in uiDateRangePicker and give it x-ref="input". When both days are picked, the date-range-picked event is sent with { start, end }.
<div x-data="{ range: null }" x-on:date-range-picked="range = $event.detail" class="space-y-2">
<div x-data="uiDateRangePicker()">
<zb:input x-ref="input" label="Report period" readonly />
</div>
<p class="text-sm text-dim" x-text="range ? 'Selected range: ' + range.start + ' – ' + range.end : 'Pick a start day and an end day.'"></p>
</div>
| Prop | Values |
|---|---|
date-range-picked | Event dispatched when the range is complete: { start, end } |
With Livewire
In a Livewire component the picked range is written to the startDate and endDate properties as Y-m-d. Add wire:ignore to the wrapper.
{{-- In the Livewire component: public ?string $startDate = null; public ?string $endDate = null; --}}
<div wire:ignore x-data="uiDateRangePicker({ startDate: @js($startDate), endDate: @js($endDate) })">
<zb:input x-ref="input" label="Report period" readonly />
</div>
| Prop | Values |
|---|---|
startDate, endDate | Initially selected range (Y-m-d) |
Installation
// npm install flatpickr
// resources/js/app.js
import flatpickr from 'flatpickr';
import { Turkish } from 'flatpickr/dist/l10n/tr.js';
import 'flatpickr/dist/flatpickr.min.css';
document.addEventListener('livewire:init', () => {
window.ZubazarUI.pro.registerDateRangePicker(window.Alpine, flatpickr, Turkish);
});
Range options
minDate: 'today' blocks past days and disabledRanges blocks the days that cannot be picked. In Livewire, change the property names to write to with startProperty / endProperty.
<div wire:ignore x-data="uiDateRangePicker({
startDate: @js($start),
endDate: @js($end),
minDate: 'today',
disabledRanges: [{ from: '2026-12-25', to: '2027-01-01' }],
startProperty: 'start',
endProperty: 'end',
})">
<zb:input x-ref="input" label="Leave period" readonly />
</div>
| Prop | Values |
|---|---|
minDate | 'today' | null | 'YYYY-MM-DD' |
disabledRanges | Closed days: dates or { from, to } ranges |
startProperty, endProperty | Properties to write to ('startDate', 'endDate') |
Developer notes
- It is built on
zb:input: the label, hint and error work the same. uiDateRangePickeruses flatpickr; the field shows dates asdd.mm.yyyyand opens two months side by side on wide screens.- On pages without Livewire, read the selection from the
date-range-pickedevent and register the picker onalpine:init.