React playground

Nova v3.37.0

Preview

React

Time field

nv-fieldtime

A form field for typing or picking a time of day.

Live demo

Format

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.

The parts of a time field, closed and open.
  1. Label (optional) names the time.
  2. Input has a box for each part of the time and a clock button.
  3. Description (optional) gives the format or allowed hours.
  4. 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.

HH:mm:ss · default
format="HH:mm"
format="hh:mm"

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.

readonly
error
success

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.
DoShow only the parts people need, and the allowed hours.
Don'tAvoid seconds when the task does not need them.

Sources