Angular playground

Nova v3.37.0

Preview

Angular

Date range field

nv-fielddaterange

A form field with paired inputs for a start and an end date, typed or picked from a calendar.

Live demo

Date Format
Size

Use a date range field when people choose a period, such as a stay or a reporting window. For a single date, use a date field.

Anatomy

A date range field with four callouts: 1 marks the label Field label, 2 the two inputs showing dd/mm/yyyy separated by a divider, 3 the description below them, and 4 the calendar button at the right end.

The parts of a date range field.
  1. Label (optional) names the period.
  2. Start and end inputs accept typed dates in the dateFormat pattern.
  3. Description (optional) explains which dates are allowed.
  4. Calendar button opens a calendar showing two months. The first day you pick sets the start, the second the end. Focusing an input also opens it; Escape closes it.

Design properties in code

Design propertyCode configuration
StateHover and focus follow interaction; use disabled or readonly for fixed states.
Errorerror shows invalid styling.
Requiredrequired adds the label marker and native input requirement.
Has label / LabelSet label or the label slot; omit both to leave it out.
Has description / DescriptionSet description or its slot; omit both to leave it out.
Has error description / Error descriptionSet errorDescription or the error-description slot; it appears when error is true.
Openopen controls the calendar popover.

The design's visibility switches correspond to supplying content; they are not separate hasLabel or hasDescription properties.

Values and limits

The value is one string, start,end, in dateFormat (YYYY-MM-DD by default). It changes once both dates are set. min, max and disabledDates disable days in the calendar, but they do not check typed dates or the days between start and end, so validate the range in your application.

Size

Use size="sm" for a 32 px field or size="md" for the default 40 px field. The field is capped at 480 px; fluid lets it fill a wider container.

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 dates without allowing changes. Set error with an errorDescription that says how to fix the range.

required
readonly

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

  • Give the field a label and a description of the allowed dates.
  • Use placeholders that show the expected date format; the defaults follow dateFormat.
  • Show validation messages as soon as a range is invalid.
DoSay how to fix an invalid range as soon as it happens.
Don'tAvoid an error state without a message.

Sources