Live demo
Demo source
Use a time field for a time of day, such as an opening time or an appointment. People type the hours and minutes, or pick them from a list. For a date, use a date field.
Anatomy
Two time fields, one showing 10:00 and one showing 10:00:00 with its list visible. Callouts 1, 2 and 3 mark the label, input and description of the first field; 4 marks the list of hours, minutes and seconds below the second field.
- Label (optional) names the time.
- Input has a box for each part of the time and a clock button.
- Description (optional) gives the format or allowed hours.
- List opens on focus or from the clock button, with a column per part.
Formats and intervals
format sets the parts shown: HH:mm:ss (the default), HH:mm or HH on a
24-hour clock, or the hh equivalents from 01 to 12. The value is a string in
that format. step (in milliseconds) and min/max limit the times offered
in the list; typed times are not limited, so validate them in your application.
For example, a 15-minute interval uses step="900000". The API has one
interval value, rather than separate hour, minute and second step props.
States
Hover and focus styles are built in. required marks the label with an
asterisk. A disabled field cannot be used, and a read-only field shows its
time without allowing changes. Set error with an errorDescription, or
success to confirm a valid time.
Validation and layout
An error combines a red border, warning icon and errorDescription. State
the expected format and allowed hours in persistent text beside the field.
The native field is capped at 480 px. The design mentions a fluid option,
but this version of nv-fieldtime does not expose that property.
Themes
The design includes Spark and Ocean appearances. Use the page's theme and mode controls to compare the live examples; retain the same labels, states and validation messages in each theme.
Guidelines
- Show the expected format and allowed hours in the description.
- Use one time format across your product.
- Leave out seconds unless the task needs them.