Native Web Components playground

Nova v3.37.0

Preview

Web Components

Date field

nv-fielddate

A form field for typing a single date or picking it from a calendar.

Live demo

Date Format
Size

Use a date field when people enter one specific date, such as a due date or a birthday. They can type it or pick it from a calendar. For a start and end date, use a date range field.

Anatomy

A date field with four callouts: 1 marks the label Field label, 2 the input showing the placeholder mm/dd/yyyy, 3 the description below it, and 4 the calendar button at the right end of the input.

The parts of a date field.
  1. Label (optional) says which date to enter.
  2. Input accepts typed dates in the dateFormat pattern, which the placeholder shows.
  3. Description (optional) adds guidance below the input.
  4. Calendar button opens the calendar. Focusing the input or pressing the down arrow opens it too; 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 a string in dateFormat, YYYY-MM-DD by default. min, max and disabledDates use the calendar's dateFormat and disable days in the calendar, but they do not block typed dates, so validate the value 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 date without allowing changes. Set error with an errorDescription to explain an invalid date.

required
readonly
error

Guidelines

  • Give every field a label and, where useful, a description of the expected date.
  • Use a date format that matches your users' expectations, consistently.
  • Keep the field focused on date entry; do not reuse it as a general input.
DoUse one date format that your users expect.
Don'tAvoid mixing date formats on one page.

Sources