Time Picker
The <x-wirekit:: component is a styled wrapper around the native <input type="time">. It uses the browser's built-in time selection UI for zero dependencies and automatic localization.
Basic Usage
12-Hour Format
Regardless of how the field is displayed, the submitted value is in 24-hour HH:MM format, or HH:MM:SS where a step under a minute lets the reader set seconds (the native <input type="time"> standard).
Note: Whether the native field reads as AM/PM or as 24 hours is decided entirely by the browser and the operating system locale — HTML has no attribute that overrides it, so neither does WireKit. On the native field the
formatprop records which reading your interface is written for and does not change what the control shows. If a specific display is a hard requirement, usepopover, which writes the times itself and followsformat.
With Step (Minutes Interval)
Available in 15-minute intervals
The step attribute is in seconds. Common values: 60 (1 min), 300 (5 min), 900 (15 min), 1800 (30 min), 3600 (1 hour). It reaches the native control, so it governs both what the field accepts and how far ArrowUp / ArrowDown move the focused segment. Left unset, the browser's own default of one minute applies.
Size Variants
Error State
Please select a valid time.
With Hint
We will notify you at this time daily.
Width
The time picker fills the width of the block it stands in, so its width is the width you give the parent; in a flex row it takes the room its content asks for instead. Time fields are typically narrow — constrain the width via the parent element:
<div class="max-w-[10rem]">
<x-wirekit::time-picker label="Start time" name="start_time" />
</div>
See Input — Width for more layout examples (grid columns, mixed widths).
Why Native?
The native <input type="time"> provides:
- Zero dependencies — no JavaScript time picker library to ship
- Automatic localization — the browser renders AM/PM or 24-hour based on OS locale
- Full accessibility — arrow keys, spinners, and keyboard input work out of the box
- Mobile keyboards — native time wheels on iOS, spinners on Android
- Consistent value format —
HH:MMregardless of display, with seconds only whenstepallows them
Popover
popover replaces the native field with a trigger that opens a list of times, written in your application's language and on the clock format names, or on the locale's clock without it. step sets the time between two times in the list, in seconds as for the native field: 900 lists a time every 15 minutes, and without it, or below 60, the list offers one every 30. min and max set the first and the last, and a max before the min runs over midnight, as on the native field: min="22:00" max="06:00" lists the night. The value, the field's name and wire:model stay as they are, so switching it on changes nothing on the server.
The trigger cuts a time it has no room for at its end, and the time's title holds it whole.
With time="input" the field takes the time typed instead, the hour, the minute and AM or PM as segments in the order of your application's locale, and the button at its end opens the list as suggestions. A digit sets a segment and moves on once no other digit fits, the arrow keys step a segment round, and a and p set AM or PM. A time typed whole and inside min and max is the value at once. Until then the field is empty, as a native time field is while a time is half typed, and a sentence under it says why a time outside min and max is not taken.
On a phone, below the kit's sm width of 640 pixels and on a screen less than 480 pixels tall, the list of times opens as a modal over the page rather than below the trigger, as the dialog of the datetime picker does: centered over a backdrop, with the page behind it held still. A tap on a time picks it as on the panel, and a tap on the backdrop closes the list as Escape does.
With readonly the time is shown and nothing opens, as on the datetime picker: the trigger, or the button of a typed time's suggestions, is marked disabled, the segments of a typed time can be moved through but not changed, 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 time entry and its time wheel on a phone, and it gains the application's clock and a list that looks the same everywhere. optimistic belongs to the native field and does nothing with popover.
Building the Dialog When It Is Needed
In popover mode a time 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 time 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::time-picker name="starts_at" label="Starts at" popover lazy />
To build every time picker this way, set it once in the components array of config/:
// config/wirekit.php
'components' => [
'time-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 this component should call and the change appears immediately, then confirms or undoes itself when the server answers:
<x-wirekit::time-picker
label="Start time"
name="start"
:value="$start"
optimistic="setStart"
/>
Load wirekit-optimistic. alongside whichever bundle you already use — it is a separate file so applications that do not use it pay nothing for it:
@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.
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 same shape as the other native form controls: the browser has already changed the value by the time any handler runs, so what this adds is the confirmation, the undo, and the announcement.
What a screen reader hears is the same for every component that supports this, and it is written out in full — one hedged announcement at the change, silence on confirmation, one more only if the server refuses, and focus that never moves — in Optimistic UI — the announcement contract. That page is also where the boundary is stated: this covers mutations, not sorting, filtering or pagination.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
optimistic |
string|null |
null |
Livewire method to call, showing the new value before the server confirms it. See Optimistic UI. |
optimisticArgs |
array |
[] |
Extra arguments appended to the optimistic action call, after the new value — the row this control belongs to. |
label |
string|null |
null |
Label text above the input |
hint |
string|null |
null |
Help text below the 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 |
error |
string|false|null |
null |
Error message (also reads from $errors). false shows none and leaves the $errors bag alone, see Turning an Error Off |
name |
string|null |
null |
Form field name |
id |
string|null |
auto-generated | Element id |
value |
string|DateTimeInterface|null |
null |
Initial time in HH:MM format, or a date object or a date and time as text, which is written as its time of day, with seconds only where step counts them. A time such as 9:30 is written as 09:30 |
min |
string|DateTimeInterface|null |
null |
Earliest accepted time (HH:MM or a date object), written as value is. Text that names no time is reported |
max |
string|DateTimeInterface|null |
null |
Latest accepted time (HH:MM or a date object), read as min is |
format |
string|null |
null |
'24h' or '12h'. On the native field it records the reading your interface is written for, and the browser and OS locale decide what is shown. With popover it sets the clock the times are written on, and without it they follow the locale |
popover |
bool |
false |
A trigger that opens a list of times, or a field that takes a typed time, in place of the native field. See Popover |
time |
string |
'list' |
With popover: list, a dialog with the list of times, or input, the time typed in segments with the list as suggestions |
clearable |
bool |
false |
With popover and the list, a button in the trigger that empties the field |
placeholder |
string|null |
null |
With popover and the list, what the trigger shows without a value |
step |
int|null |
null |
Step interval in seconds, passed to the native step attribute. A value, min or max with seconds keeps them only on a step that counts seconds, such as 1 |
size |
string |
'md' |
'sm', 'md', 'lg' |
disabled |
bool |
false |
Disabled state |
required |
bool |
false |
Required field |
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.time-picker.lazy in config/wirekit.php sets the default. See Building the Dialog When It Is Needed |
scope |
string|null |
null |
Scoped personalization key |
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. |
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:time-picker-open |
The dialog with the list opens |
wirekit:time-picker-close |
The dialog closes, however it closes |
wirekit:time-picker-clear |
The reader empties the field with the clear button |
Its hidden field fires input and change for each time picked, as a native field does, so wire:model. and wire:model.blur work as on any field.
Accessibility
- Native
<input type="time">— full browser a11y and keyboard support aria-invalid="true"andaria-describedbyset on errorrequiredpasses straight through to the native input, which is what announces the field as required. Inside a required field without arequiredof its own, the input carriesaria-required="true"instead, which announces it without turning on the browser's own check- Hint text linked via
aria-describedby - Focus ring visible via
focus-visiblestyling - Arrow keys increment/decrement hours and minutes (native behavior)
- The value is submitted as
HH:MMregardless of locale display,HH:MM:SSwherestepallows seconds - With
popover, the trigger is a button witharia-haspopup="dialog",aria-expandedandaria-controls, named by the label and the time it shows, and "(required)" for a required field. Enter, Space and Down Arrow on the trigger open the dialog, which is named by the label and what it is for, "Alarm, Select a time", and holds alistboxof times: the arrow keys move between open times, Home and End go to the first and the last, Page Up and Page Down an hour, typing goes to the time typed, and Enter picks it, closes the dialog and returns the focus to the trigger - With
popoverandtime="input", the segments are spin buttons named "Hour", "Minute" and "AM/PM", in a group named by the label and described by the hint and the error. Up and Down change a segment, Left and Right move between them, and the button at the end, "Suggested times", opens the list. Escape closes the list. The sentence that says why a typed time is not taken is announced
Keyboard Interaction
| Key | Action |
|---|---|
Tab |
Move focus into the time input |
Type HH:MM characters |
Set the value directly |
ArrowUp / ArrowDown |
Step the focused field by ±1 |
On a right-to-left page, where the segments of a typed time run from the right, Left Arrow moves to the next segment and Right Arrow to the previous one.
Pitfalls
- Don't use time-picker for durations. Native
<input type="time">represents a clock time, not "2 hours 30 minutes". For durations use two<x-wirekit::(hours / minutes).number-input> - Don't bind a date object. Livewire sends a
Carbonproperty, or a property that holds a date, to the browser as a full timestamp, which<input type="time">drops, so the field stays empty. Bind astringproperty that holds->format('H:i')and convert it when you save. In debug mode the component logs a warning for a binding to a date object.
Design Tokens
| Token | Purpose |
|---|---|
--color-wk-bg-input |
Input background |
--color-wk-border-strong |
Default border color |
--color-wk-border-error |
Border color on error |
--color-wk-text |
Input text color |
--color-wk-text-placeholder |
Placeholder text color |
--color-wk-ring |
Focus ring color |
--size-wk-sm / md / lg |
Input height per size variant |
--radius-wk-md |
Border radius |
--padding-wk-x-md |
Horizontal padding |
--text-wk-md |
Font size |
--transition-wk-duration |
Focus/error transition speed |
--opacity-wk-disabled |
Dimmed state when disabled |
--color-wk-bg-elevated / --color-wk-border / --shadow-wk-lg |
With popover, the surface, border and shadow of the list's dialog and of the suggestions |
--size-wk-time-list |
With popover, the width of the list of times |
--size-wk-xl |
With popover, the least height of the list of times |
--color-wk-accent / --color-wk-accent-fg |
With time="input", the segment that has the focus |
Customization
Override defaults in config/:
'components' => [
'time-picker' => ['size' => 'md'],
],
Further Reading
- MDN:
<input type="time"> - MDN: Date and time input types
- Can I Use:
input type=time— browser support matrix - MDN:
stepattribute - MDN:
aria-invalid