Forms with time picker fields for selecting times. Time pickers provide an intuitive interface for time selection with support for constraints, step intervals, and combination with date pickers for complete scheduling solutions.
Every code snippet below is fully editable! Feel free to modify the code, experiment with different values, and see your changes reflected instantly in the live preview on the right.
Use the play button to run different snippet, or the refresh button to restore the original example.
Let's start with an empty form function. This is where we'll build our time-based form step by step.
Let's add a simple time picker for selecting a meeting time. The browser provides a native time input interface.
addTimepicker() to add a time field. The value is stored in 24-hour format as "HH:mm" (e.g., "14:30" for 2:30 PM). Make a time field required to ensure users select a time before submitting the form.
isRequired: true to make the time mandatory. The form won't submit until a valid time is selected. Limit selectable times using minTime and maxTime. This is perfect for business hours or delivery windows.
minTime and maxTime in "HH:mm" format. For example, minTime: '09:00' and maxTime: '17:00' restricts selection to 9 AM - 5 PM. Use computedValue to automatically set time based on other form fields. This is useful for shift schedules, preset times, or calculated values.
computedValue function runs reactively - when referenced fields change, the time updates automatically. Combine with isReadOnly: true for display-only computed times. Combine date and time pickers in a single row for complete datetime selection. This is the most common pattern for scheduling.
form.datepicker('id')?.value() and form.timepicker('id')?.value(). Let's build a complete meeting scheduler with start/end times and automatic duration calculation.
(endHours * 60 + endMinutes) - (startHours * 60 + startMinutes) gives the duration in minutes. Excellent! You've mastered time pickers and learned how to build scheduling forms. Ready to explore more advanced features?
Continue to Computed Values TutorialOther learning paths: