Skip to main content
Copy for LLM

Date Picker

The <x-wirekit::date-picker> component is a styled wrapper around the native <input type="date">. It uses the browser's built-in calendar popup for zero dependencies and automatic localization to the user's OS locale.

Usage

Basic Date Picker

Width

Like all WireKit form components, the date picker fills its container (w-full). Date fields are typically narrow — constrain the width via the parent element:

Date picker in a 12rem container

See Input — Width for more layout examples (grid columns, mixed widths).

Date Range

Add the range flag to render a linked start + end pair. Each field is a native date input, and the two are reactively linked — the end can't be set before the start, and the start can't be set after the end. They submit as name[start] and name[end]. Both fields carry min and max from the first render, so the browser's own picker and its check keep to them before the script runs; keeping the end after the start takes the script. Pass an initial range as an array or a YYYY-MM-DD/YYYY-MM-DD string. A date object works for either end, and for value, min and max outside a range: the field reads the day it names. So does a date and time written as text, such as 2026-03-15 14:30:00 or the ISO 8601 that Laravel writes into JSON, read in your application's time zone.

What acts on a date goes to both fields, as it goes to the field of a single date: form, readonly, autocomplete, step, list and the keyboard hints. autofocus goes to the start.

A range binds with wire:model, which reaches the two ends as {property}.start and {property}.end. An x-model binds a single date but not a range, which drops it: see An x-model on a WireKit component.

Date range

Binding a range

A Livewire property typed with Pushery\WireKit\Values\DateRange stays a range while the date picker sets its two ends as {property}.start and {property}.end. Below they are period.start and period.end, the keys a validation rule names:

<x-wirekit::date-picker name="period" label="Period" range :value="$period" wire:model.live="period" />

The component class, validation and queries are on the calendar's page under Binding a range; a calendar and a date picker can bind the same property.

Range Constraints

With Min and Max

Must be in 2024

Error State

Date picker with an error message

Please enter a valid date

Why Native?

The native <input type="date"> gives us:

  • Zero dependencies — no JavaScript calendar library to ship
  • Automatic localization — the field and its calendar follow the language of the reader's browser
  • The browser's keyboard entry — the day, the month and the year are typed, or stepped with the arrow keys, and the browser's own calendar opens from the field
  • The phone's own picker — a phone opens its date picker instead of a calendar built for a mouse
  • The browser's parsing — what the reader types is read by the browser, which accepts only real dates

The value is always submitted in YYYY-MM-DD format regardless of the display format.

The order is the browser's, and it is not yours to set

That second bullet is a benefit and a trap in the same sentence. A native date field takes its order from the browser's user-interface language, never from the language of the page around it — and no author can change that. It is not an authorable property in any shipped browser.

So a German page read on an English laptop asks for mm/dd/yyyy while every word beside it is German, and the misreading is silent: 03.04.2026 and 04/03/2026 are both valid dates. Nothing is rejected, no error appears, and the record carries a different day than the person meant. On a birth date, a delivery date or a cut-off in a report, that is real damage.

format-hint says so, in the language of the page, with a worked example:

A field that discloses the browser's order

It renders nothing when the browser and the page write dates in the same order, which is the overwhelmingly common case — you will most likely see nothing above. The sentence is composed in the browser, because only the browser knows its own order; its wording comes from your application's language.

The browser's order is read from the locale Intl uses when it is given none, which Chrome, Firefox and Safari each take from the setting they draw their date fields in. navigator.language is a different setting in Chrome and Firefox: the first of the languages the reader prefers for websites. A German Chrome with English first among those languages draws dd.mm.yyyy while navigator.language says en-US.

A browser test is the one place where the two can part: a locale set on the test's browser context (Playwright's locale, withLocale() in a Pest browser test) changes what Intl and navigator.language report, while Chrome keeps drawing its date fields in the language of its own interface. Give the context that language, or a screenshot shows the sentence below a field that already writes dates in the page's order.

To turn it on for every date picker, set components.date-picker.format-hint to true (see Config Defaults). A plain date field takes the same prop, and datetime-local does too.

Want the application's own format instead?

That means giving up the native field, and the cost is three of the bullets above: the browser's keyboard entry and calendar, the phone's own picker, and the browser's parsing. calendar is the component that makes that trade — it takes the application locale and draws the dates itself. Reach for it when the format matters more than the affordances, and keep this one when it does not.

Popover

popover replaces the native field with a trigger that opens a dialog with the calendar. The dates are written in your application's language and format, the dialog has the calendar's limits and options, and it looks the same in every browser. The value, the field names and wire:model stay as they are, so switching it on changes nothing on the server.

A date picker with a calendar

The trigger cuts a date it has no room for at its end, and the date's title holds it whole.

With range the dialog shows two months. The first day picked waits for the second, and the second takes both and closes the dialog. A dialog closed in between leaves the range as it was.

A range in two months

The calendar in the dialog takes unavailable, min-range, max-range, months, open-to, with-today, selectable-header, week-numbers, week-starts-on and fixed-weeks as the calendar does, and min and max close the days outside them. clearable adds a button to the trigger that empties the field.

Presets

With range, presets lists ranges such as "Last 7 days" beside the calendar in the dialog, as on the calendar. A preset picked takes its range and closes the dialog.

A range with presets

The range then carries its preset beside its two ends: a form receives it as name[preset], and wire:model binds it as property.preset. A property typed with DateRange keeps it, $range->preset(), and an array property gets a preset key. A range picked day by day sends an empty preset.

On a phone, below the kit's sm width of 640 pixels and on a screen less than 480 pixels tall, the dialog opens as a modal over the page rather than below the trigger, as the datetime picker's does: centered over a backdrop, with the page behind it held still, the days as large as a touch target as far as the width allows, and one month for a range with its presets as a select above it. A tap on a day picks it as on the panel, and a tap on the backdrop closes the dialog as Escape does.

With readonly the date is shown and nothing opens, as on the datetime picker: the trigger is marked disabled, there is no clear button, and the field still submits its value with the form. With required, an empty read-only picker does not stop the submit, as a read-only native field does not.

The trade is the one Why Native? describes, seen from the other side: the popover gives up the browser's own date entry and the phone's own picker, and it gains the application's format and a calendar that looks the same everywhere. optimistic and format-hint belong to the native field and do nothing with popover.

Building the Dialog When It Is Needed

In popover mode a date picker builds its dialog with the page, and the dialog starts its script, though most fields on a page are filled without opening it. With lazy, the date picker keeps its dialog in a <template> until it first opens. Once built, the dialog stays when it closes again, and it opens, takes the keyboard and closes as a dialog built with the page does. The trigger names the dialog with aria-controls from the moment it is built.

{{-- 1. The dialog is built the first time it opens --}}
<x-wirekit::date-picker name="due" label="Due date" popover lazy />

To build every date picker this way, set it once in the components array of config/wirekit.php:

// config/wirekit.php
'components' => [
    'date-picker' => ['lazy' => true],
],

Until the dialog has opened, it is not part of the page: a script that looks for something inside it, and a browser test that reads it before the dialog opens, find nothing. Open the dialog first, or leave lazy off where something has to find it while it is closed.

Optimistic UI

Pass the name of the Livewire method the picker should call and the date lands immediately, then confirms or undoes itself when the server answers:

<x-wirekit::date-picker
    name="due"
    label="Due date"
    :value="$due"
    optimistic="saveDue"
/>

Load wirekit-optimistic.js alongside whichever bundle you already use — below it, in your layout:

@wirekitScripts
<script src="{{ asset('vendor/wirekit/wirekit-optimistic.js') }}" defer></script>

Try it

The demo below runs the real path: the change shows immediately, the outline says it is provisional, and the server's answer either confirms it silently or takes it back.

Optimistic date — accepted, refused, and a slow answer

The <livewire:demos.…> wrapper above exists only on this site — it supplies the demo methods so the page can show a real round trip. The block under it is what you write.

The prop takes a method name rather than true because the component cannot know the action otherwise: server actions reach a WireKit component through the attribute bag, so it never sees your wire:change. optimistic replaces wire:model.live here rather than joining it — the method you name is what changes the value on the server; pass the current one with :value so the picker knows where it started.

range mode is not covered. A range is two values, so an undo would have to answer what it restores when only one end moved — and the two inputs constrain each other, so rolling one back can leave the other holding a bound that no longer applies. Passing both props gives you the plain range picker rather than a layer applied to half of it.

What a screen reader hears

Picking a date announces once, hedged — "Saving" — so the new value is audible as provisional. Confirmation is silent: what was announced is what happened. Only a deviation speaks a second time, which is what makes an undo recognizable as an undo.

Where the picker shows a validation message, the undo stays silent and leaves that message to speak: it tells you what to do, "could not save" does not.

An aborted request announces nothing at all — nothing was refused.

Focus stays exactly where you put it. An undo arrives on the server's schedule, and moving focus then would take you out of your place for a reason you could not predict.

Props

Prop Type Default Description
name string|null null Form field name (range mode submits name[start] / name[end])
id string|null derived Element id. Without one it is derived from name, then from the bound wire:model property (wire:model="due" gives wk-date-due), and counted in page order when there is neither. A second date picker with the same name or property on the page gets -2, so each label and hint names its own field. It is the same on every render, so a Livewire round trip keeps the input a reader is typing into. A <label for> of yours with this id names the field, and then no fallback name stands over it
value string|DateTimeInterface|DatePeriod|array|null null Initial date YYYY-MM-DD or a date object; in range mode an array ['start' => .., 'end' => ..] (each end a string or a date object), a YYYY-MM-DD/YYYY-MM-DD string, or a DateRange. See Binding a range.
optimistic string|null null Livewire method to call, showing the new date before the server confirms it. Single-date mode only; ignored with range or disabled. See Optimistic UI.
optimisticArgs array [] Extra arguments appended to the optimistic action call, after the new value — the row this control belongs to.
range bool false When true, renders a linked start + end date pair
min string|DateTimeInterface|null null The first day a reader can pick: YYYY-MM-DD, a date and time, a date object, today or now, read as its day in the application's time zone, in the field as in its calendar. Two days the wrong way round are read as the days between them, and text that names no day is reported
max string|DateTimeInterface|null null The last day a reader can pick, read as min is
size string 'md' 'sm', 'md', 'lg'
disabled bool false Disabled state
required bool false Required field
placeholder string|null null Placeholder (browser-dependent). With popover, what the trigger shows without a value
popover bool false A trigger that opens a dialog with the calendar, in place of the native field. See Popover
clearable bool false With popover, a button in the trigger that empties the field
presets bool|string|array|null null With range and popover: a list of ranges beside the calendar in the dialog, as the calendar's presets takes it. See Presets.
unavailable array|string|null null With popover, days the calendar closes. See the calendar
minRange int|null null With popover and range, the fewest days a range may cover, both ends counted
maxRange int|null null With popover and range, the most days a range may cover, both ends counted
months int|null null With popover, the months the calendar shows, one to four: 2 for a range and 1 otherwise unless given
openTo string|DateTimeInterface|null null With popover, the month the calendar opens on without a value
withToday bool false With popover, the calendar's today button
selectableHeader bool false With popover, the calendar's month and year selects
weekNumbers bool false With popover, the calendar's week numbers
weekStartsOn int|string 1 With popover, the first day of the calendar's week, from 0 to 6, or locale
fixedWeeks bool false With popover, six rows in every month
hint string|null null Helper text below input
help string|null null An explanation of the field, shown in a tooltip from a question mark beside the label and read as the field's description. Needs a label to stand beside. See Help beside the label
formatHint bool false Say so when the browser writes dates in a different order than the page. Renders nothing when they agree. It does not change the order — see The order is the browser's. The default comes from components.date-picker.format-hint
label string|null null Visible label above the input. Supplies the accessible name; without it, pass aria-label
announceError bool|null null Render the error message in an aria-live="polite" region so a validation error that appears after render reaches a screen reader. Precedence: this prop, then the parent <x-wirekit::form :announce-errors>, then config('wirekit.a11y.announce_error'). Set false when the page runs its own live region.
error string|false|null null Error message (also reads from $errors, for a range the messages of its two ends as well, {name}.start and {name}.end). false shows none and leaves the $errors bag alone, see Turning an Error Off
lazy bool false In popover mode, keep the dialog out of the page until it first opens; the trigger names the dialog from then on. components.date-picker.lazy in config/wirekit.php sets the default. See Building the Dialog When It Is Needed
scope string|null null Scoped personalization key

Slots

Slot Description
labelAfter Markup after the label and its help question mark, in the same row and outside both, such as a badge that says a setting is not decided yet. See A Mark After the Label.

Events

With popover, the picker dispatches these on its root, and they bubble:

Event When
wirekit:date-picker-open The dialog opens
wirekit:date-picker-close The dialog closes, however it closes
wirekit:date-picker-clear The reader empties the field with the clear button

Its hidden fields fire input and change for each date picked, as a native field does, so wire:model.change and wire:model.blur work as on any field.

Accessibility

  • Native <input type="date"> — full browser a11y and keyboard support
  • aria-invalid="true" and aria-describedby on error
  • aria-required="true" when required
  • Focus ring and border color tokens adapt to light/dark mode automatically
  • With popover, the trigger is a button with aria-haspopup="dialog", aria-expanded and aria-controls, named by the label and the date it shows, and "(required)" for a required field. The dialog is a role="dialog" with aria-modal="true", named by the label and what it is for, "Due date, Select a date". Enter, Space and Down Arrow on the trigger open it and move the focus to the day of the value, or without one to today or the next day that can be picked, on every opening, the calendar brings its own keyboard and names, and Escape closes the dialog and returns the focus to the trigger.

Keyboard Interaction

Key Action
Tab Move focus into the date input
Type characters into the focused segment Set the value directly. The segment order the browser presents is the viewer's locale, not a format the page configures
ArrowUp / ArrowDown (in supporting browsers) Step the focused field by ±1
Enter / Space / ArrowDown on the popover trigger Open the dialog and move the focus to the day of the value, or to today or the next day that can be picked
Escape in the dialog Close it and return the focus to the trigger

Pitfalls

  • Don't bind a date object. Livewire sends a Carbon property, or a property that holds a date such as a model attribute with a date cast, to the browser as a full timestamp (2026-10-05T00:00:00+00:00). The underlying <input type="date"> drops a value that is not a date, so the field stays empty, and after a choice the server's answer empties it again. Bind a string property that holds ->format('Y-m-d') and convert it when you save. In debug mode the component logs a warning for a binding to a date object.
  • Don't build your own calendar around the field. By default this component wraps <input type="date">, which brings the platform's own keyboard model and screen-reader announcements with it. When the native picker does not fit, popover puts the calendar in a dialog with the trigger, the focus handling and the field names already wired, and keeps the value the same. A month grid to look at, outside a form field, is <x-wirekit::calendar> on its own.

Design Tokens

Token Used for
--text-wk-xs / --text-wk-sm / --text-wk-md / --text-wk-lg Font size per size prop
--color-wk-text The date in the field
--color-wk-text-muted Calendar icon + hint
--color-wk-text-placeholder Empty-state text
--color-wk-bg-input Input background
--color-wk-accent-text Border of the focused field, without an error
--color-wk-border-strong Default border
--color-wk-border-error Error-state border, kept under focus
--color-wk-danger-text Error message, and the focus ring of a field with an error
--color-wk-ring Focus ring
--ring-wk-width Focus ring width
--border-wk-width Border width
--radius-wk-md Border radius
--size-wk-sm / --size-wk-md / --size-wk-lg Input height per size prop
--padding-wk-x-md Input padding
--padding-wk-x-sm Gap between the two fields of a range
--opacity-wk-disabled Disabled visual weight
--transition-wk-duration Hover / focus transition
--color-wk-bg-elevated / --color-wk-border / --shadow-wk-lg / --radius-wk-lg With popover, the dialog's surface, border, shadow and corners

Config Defaults

The defaults live in config/wirekit.php under components.date-picker. Override them globally:

'components' => [
    'date-picker' => ['size' => 'md', 'format-hint' => false],
],

format-hint set to true turns the order hint on for every date picker, and a picker that passes format-hint itself keeps its own value. The absence worth naming is format. A native <input type="date"> displays the date in the viewer's locale by specification — the page does not get a say, so there is nothing for a format option to do. The value the form receives is YYYY-MM-DD whatever the viewer sees. For a field that writes dates in your application's format, use popover, which draws the calendar itself; to show a date as text, format it on the server (->format('d.m.Y')).

Further Reading

Updated in WireKit v2.74.0 (2026-11-24)

Was this page helpful?

Thank you for your feedback!

Voting requires cookies or local storage. What we store