v0.0.2
Demos (demo panel, opens in a new tab)

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

PRO

This component is in Zubazar UI Pro; Zubazar UI Pro brings Zubazar UI with it. Installing Zubazar UI Pro →

Basic usage

Basic usage: view
BLADE

value is always given as YYYY-MM-DD; on screen it follows the user's language (e.g. 10/07/2026).

blade
<zb:date-picker name="delivery_date" label="Delivery date" value="2026-10-07" hint="The day emailed to the customer." />
PropValues
valueYYYY-MM-DD
label, hintSame as zb:input

Types

Types: view
BLADE

Use type for date and time, time only or a month; each type's value format is in the table.

blade
<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" />
PropValues
typedate | datetime-local | time | month
valueYYYY-MM-DD · YYYY-MM-DDTHH:MM · HH:MM · YYYY-MM

Earliest and latest date

Earliest and latest date: view
BLADE

min and max block the days outside the range; write them in the same format as value.

blade
<zb:date-picker name="october_delivery" label="Delivery date" min="2026-10-01" max="2026-10-31" hint="Only a day in October 2026." />
PropValues
minFirst value that can be picked
maxLast value that can be picked

Props

The values the component takes. What are props and slots?

PropTypeDefaultDescription
label—nullLabel above the field
name—nullField name; otherwise the wire:model value
hint—nullHelp text below
type—datedate · datetime-local · time · month
input-class—nullClasses of the <input> element itself (added to the calendar icon's classes)
uiDateRangePicker: startDate, endDate—''Initially selected range (Y-m-d)
uiDateRangePicker: minDate—nullFirst 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

4 examples

Date range

Date range: view
BLADE

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 }.

blade
<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>
PropValues
date-range-pickedEvent dispatched when the range is complete: { start, end }

With Livewire

BLADE

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.

blade
{{-- 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>
PropValues
startDate, endDateInitially selected range (Y-m-d)

Installation

JS
js
// 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

BLADE

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.

blade
<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>
PropValues
minDate'today' | null | 'YYYY-MM-DD'
disabledRangesClosed days: dates or { from, to } ranges
startProperty, endPropertyProperties to write to ('startDate', 'endDate')

Developer notes

Events, hooks and details
  • It is built on zb:input: the label, hint and error work the same.
  • uiDateRangePicker uses flatpickr; the field shows dates as dd.mm.yyyy and opens two months side by side on wide screens.
  • On pages without Livewire, read the selection from the date-range-picked event and register the picker on alpine:init.
Zubazar UI · ZubazarDesigned for people.