Forms

Time picker

A time field: a button that opens a list of times in steps (every 30 minutes by default), or a text input where the time can also be typed. The value is HH:MM, shown in the app's locale (14:30 or 2:30 PM).

Starts at: "09:00"
Blade

A button showing "9:00 AM" with a chevron: times are shown in the app's locale, in 12 hours with the default en and in 24 hours, without AM or PM, in locales such as pt_BR. Clicking it opens a list from 12:00 AM to 11:30 PM (to 23:30 in 24 hours), scrolled to the chosen time; picking one closes the list and sets $startsAt, e.g. '14:30'. Arrow keys move through the list and Enter picks.

Typing the time #

The first is a text input that also opens the list. It is masked as 99:99 AM in 12-hour locales such as the default en (typing 0230PM gives 02:30 PM) and as 99:99 in 24-hour ones (typing 1430 gives 14:30). A complete time is set as it is typed (in 12-hour locales only once AM or PM is typed, or when the user leaves the field or presses Enter, where it counts as AM); an incomplete or invalid time puts the previous one back, and an emptied input clears it. The second is the input alone, with no list.

Ends at: null
Blade

Limits and steps #

Times every 15 minutes between 8 AM and 6 PM, in 12-hour format; the lunch break (12:00 PM to 1:30 PM, both included) and 4:45 PM are disabled.

Blade

Several times #

The list stays open and each time is toggled on and off. The value is a comma-separated string of the picked times, sorted, e.g. '08:00,12:00,20:00'; an array is also accepted as the initial value.

Reminders: "08:00,20:00"
Blade

Sizes and states #

size scales the field and the field props work as usual (help, icon...); disabled blocks it.

Every 30 minutes.

Blade

Picked event #

picked fires on the tag with { value } when the user picks or types a time.

Last picked:
Blade

Customization #

Classes go to the field; prefixed attributes reach the button (trigger:), the list (list:) and each time (slot:).

Blade

Reference

tk:time-picker

Prop Type Default Description
trigger string button input uses a text input that can be typed in, instead of a button.
dropdown bool true false removes the list, leaving only the text input.
interval int 30 Minutes between the times in the list.
min, max string | date null The earliest and latest times that can be picked (08:00). A date object is read as its time in app.timezone. A min later than max spans midnight: min="22:00" max="02:00" allows 22:00 to 02:00.
unavailable string | array null Times or ranges that cannot be picked: 12:00-13:30, 16:45. A range includes both ends: 12:00-13:00 also makes 13:00 unavailable.
multiple bool false Lets several times be picked.
format string the locale's 12-hour or 24-hour.
openTo string the value The time the list scrolls to, and focuses when opened from the keyboard, when it opens with no value. A value between steps opens on the nearest step.
locale string the app's The locale used to show the times.

Also accepts the field props (label, placeholder — "Select time" by default —, value, help...) and the field control props. wire:model and x-model bind HH:MM, or with multiple a comma-separated string of them.

Events

Event Detail When
picked { value } The user picked or typed a time. value is HH:MM, null when the picked time is clicked again (or the typed text is emptied), and an array of times with multiple.

Prefixes

Prefix Goes to
picker: The element around the trigger and the list.
trigger: The button or the text input.
popover:, list: The dropdown panel and the list of times.
slot: Each time in the list.
placeholder:, formatted: The placeholder and the shown value, on the button.

Events

picked is dispatched on the hidden field, the element the tag's attributes go to, and does not bubble: listen on the tag itself.

blade

Customization

Classes and attributes go to the field; the parts take prefixes (listed in the Reference above).

blade

Accessibility

Follows the WAI-ARIA combobox pattern with a listbox popup: the trigger has aria-haspopup="listbox" and aria-expanded, the times are options with aria-selected, and the times that cannot be picked are disabled and skipped. Opening the list moves the focus to the selected time. Without a label, give the trigger a name with trigger:aria-label.

Key Action
Enter, Space, Arrow Down Opens the list (on the button trigger).
Arrow Up Opens the list on the last time.
Arrow Down / Arrow Up Moves through the times. In the text input, moves the focus into the list when it is open.
Home / End Moves to the first or the last time.
Enter Picks the focused time. In the text input, confirms the typed time and closes the list.
Escape Closes the list.

Behavior notes

  • Inside Livewire, min, max, unavailable and disabled follow the component: a new min sent by the server applies on the next update.
  • With trigger="input", clicking the input opens the list and keeps the focus in the input, so the time can still be typed.
  • A value longer than the button, such as many times with multiple, is cut with an ellipsis, and so is a long placeholder; the field does not grow with it.