Date Input

Date Inputs allow users to enter or select a date.

Figma
Sources
Figma

Anatomy

the basic elements of a date input

  1. Label: Title of the input.
  2. Input Container: Rectangular container that houses the date.
  3. Placeholder/Input Text: Placeholder text displays the expected date formatting. As the user enters data this placeholder text is replaced with the input text. Only displayed when using the keyboard style entry.
  4. Pill: Displays the selected date. Only displayed when using the picker style entry
  5. Calendar Icon: Used to help aid in visually describing the context of the input.

Usage Guidance

When to Use

  • When asking for a known date from the user.

When to Consider Something Else

  • Use a Text Input when the intended user input is all or partially text based.
  • Consider a Prompt, Radio or Checkbox if there are relative (i.e. tomorrow, 2 days after) or predetermined dates that a user can pick from.
  • Time Inputs/pickers should be used for all time based data (i.e. 10:30 pm)

Behaviors

Size

Date inputs are purposefully sized differently from other text inputs. Most of the time inputs will stretch to fill the width of the screen on mobile. Dates are typically shorter in length. The smaller date input helps provide more context into the expected entry.

Examples

The date input uses two types of data entry depending on the type of date needed.

Picker

The picker style entry allows quick and easy selection of dates within a year of the current date, past or future. However, pickers may be troublesome when selecting far out dates. Consider using the keyboard style entry in these cases.

image of the native date picker

Keyboard

The keyboard style entry invokes the native number pad to provide a clearer expectation for the type of entry required. This type of entry should be used for very well known dates, like birthdays, or dates well over a year out, past or future.

image of a date input along with a numberpad

API Guidelines

Methods

Class name: LabelledDateInput Module name: UIComponentsPlugin

public init(
featureData: FeatureMetricsData,
dateInput: Binding<Date?>,
label: String,
helperText: String?,
dateTemplate: DateTemplate,
context: Binding<SemanticContext>,
isCalendarIconHidden: Bool,
localizer: LocalizationAdapting
)

Parameters

NameDescription
featureDatathe feature name/context and the screen ID in which the component appears.
dateInputBinding for the date to be displayed in the component.
labeltitle of the date input, already localized.
helperTextthe helper text for the date input, already localized.
dateTemplateDate template that defines the type fields dateinput contains ex: MMddyyyy, This displays all three fields month, day and year where as MMyyyy diplays only month and year
contextbinding to the semantic context.
isCalendarIconHiddenwhether the calendar icon should be shown.
localizerprovider of localized strings, conforming to LocalizationAdapting

Accessibility Guidelines

Coming soon…

Content Guidelines

  • Labels for Date Inputs are written in title case.
  • Use helper text to instruct the user what the proper input may be.
  • Use placeholder text only to provide examples of proper inputs. Never use placeholder text to help instruct users.

Can't Find What You Need?

Check out our FAQ section which may help you find the information you're looking for. For further information, contact the #canvas or #canvas-kitchannels on Slack.

FAQ Section