On this page
@addTagHelper *, Webority.Ui.RazorValue and onChange
The picker is controlled: value holds a 24-hour HH:mm string, and onChange gives back the new one.
HH:mm: 14:30
Min and max
Keep the choice inside a window with min and max, so an out-of-range time is shown as an error.
Business hours only (09:00 to 17:00). Times outside the window can't be picked.
Step
Set step in minutes to match the schedule, such as 15 minutes for bookings.
Typing and keyboard
People can type a time and commit it with Enter, or step through the columns with the arrow keys.
Display format
Choose 12-hour or 24-hour display for people; the value always stores as 24-hour HH:mm.
Placeholder
Use a placeholder to say what the empty field expects, beside a label rather than in place of one.
Size and width
Match the time field to the inputs beside it, and resize it only when its content needs room.
Every option
Every value of every prop, one cell each.
value: the controlled time
value="14:30"value="" (no time chosen)defaultValue: starting time, uncontrolled
value="09:30" (React: defaultValue)label: the label above the field
label="Meeting time"name: the posted field name
name="meetingTime" (posted with the form, no visible change)id: the control's id
id="meeting-time" (no visible change)ariaLabel: the accessible name
aria-label="Meeting time" (React: ariaLabel; screen readers only)required: the required mark
required="true"optional: (optional) after the label
optional="true"optionalLabel: the text for (optional)
optional="true" optional-label="(facultatif)"helperText: help under the field
helper-text="24-hour format"error: an error message
error="A time is required"help: info tip beside the label
help="Times are in IST"helpLabel: the info tip's accessible name
help="Times are in IST" help-label="About meeting times"min and max: the selectable window
min="09:00" max="17:00"min="00:00" max="12:00" (morning only)step: minutes between choices
step="1"step="15"step="30" (default)step="60"format: 24 or 12 hour display
format="24" (default)format="12"placeholder: text while no time is chosen
placeholder="Select time" (default)placeholder="Pick a meeting time"size: every height tier
size="md" (default)size="sm"size="lg"disabled: locks the field
disabled="true"readOnly: shows the value, blocks editing
read-only="true"loading: busy state, blocks input
loading="true"className: a class on the control
input-class="time-w-full"fieldClassName: a class on the wrapping field
class="mb-3" (React: fieldClassName)onChange: the callback
change event: fires when a time is committed (React: onChange)Guidance
What to do, and what to avoid.
Use it when
- Capturing a time of day: a meeting time, a schedule slot, a booking time.
- You need one consistent time picker across every browser and both surfaces.
- Restricting selection to a valid window with min / max.
- Controlling step granularity (1, 15, 30, or 60 minutes).
Reach for something else when
- You need both a date and a time. → a date picker next to a time picker
- The value is free text, not a time. → AppInput
- You are picking from a fixed list of labels. → AppSelect
Reference
Try every prop, read the full list, and check keyboard and screen reader behaviour.
20 props. The 5 most used come first.
Used on most screens 5 props
| Prop | Type | Default | Description |
|---|---|---|---|
| labeldefault - | string | - | The label above the field. |
| valuedefault - | string | - | The time as 24-hour "HH:mm" text, which is also the wire format. |
| requireddefault false | bool | false | Marks the field required and shows the required mark beside the label. |
| helper-textdefault - | string | - | Help text under the field. |
| errordefault - | string | - | An error message. It replaces the helper text and marks the field invalid. |
Less common 15 props
| Prop | Type | Default | Description |
|---|---|---|---|
| namedefault - | string | - | The field name the time posts under. |
| mindefault - | string | - | The earliest time that can be picked, as "HH:mm". |
| maxdefault - | string | - | The latest time that can be picked, as "HH:mm". |
| stepdefault 30 | number | 30 | The minutes between choices. The control uses 30 when this is unset. |
| formatdefault 24 | 12 | 24 | 24 | The display format, 12 or 24 hour. The wire value stays 24 hour. |
| placeholderdefault Select time | string | Select time | The text shown while no time is chosen. |
| optionaldefault false | bool | false | Ends the label with (optional) when the field is not required. Required wins when both are set. |
| optional-labeldefault (optional) | string | (optional) | Replaces the built-in English text, for other languages. |
| helpdefault - | string | - | Info-tip text shown beside the label. |
| help-labeldefault More information | string | More information | The accessible name of the info-tip button. |
| sizedefault - | sm | md | lg | - | The control height tier, matching AppInput; leave unset for the default height. |
| disableddefault false | bool | false | Locks the field. |
| read-onlydefault false | bool | false | Shows the value but blocks editing. The value still posts. |
| loadingdefault false | bool | false | Shows a busy state and blocks input while data loads. |
| input-classdefault - | string | - | Extra classes on the control itself. The plain class attribute merges onto the field wrapper instead. |
Screen reader
4 notes- The trigger is named by ariaLabel, or by a text label when there is none.
- An error sets aria-invalid and points aria-describedby at the error text, or at the helper text when there is no error.
- The field carries the required attribute as well as the visible required mark.
- The info tip beside the label is named by helpLabel.