Component Date Picker Input

The date picker input is used to display a date that has either been selected from the date picker or typed in by the user.

CodeUsage

Example

Give users instructions
Sun
Mon
Tue
Wed
Thu
Fri
Sat
Sun
Mon
Tue
Wed
Thu
Fri
Sat
May 2025
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
June 2025
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
July 2025
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
August 2025
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Format must be in MM/DD/YYYY.
This example has a tooltip.
Sun
Mon
Tue
Wed
Thu
Fri
Sat
Sun
Mon
Tue
Wed
Thu
Fri
Sat
March 1984
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
April 1984
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
May 1984
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
June 1984
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

Props

AttrTypeDefaultDocs

disabled

boolean

false

When set to true, this boolean ensures that the input will be disabled.

error

string

null

This property sets the input error message. If a non-empty string is given, it will be used as the error message.

format

"MM-DD-YYYY" | "MM/DD/YYYY" | "YYYY-MM-DD" | "YYYY/MM/DD"

'MM/DD/YYYY'

This property sets the date format.

help

string

''

This property sets the help text rendered below input.

hide-label

boolean

false

This property will visually hide the label. A label is still required to be provided for screenreader support.

horizontal-position

"left" | "right"

'left'

This property sets the horizontal position of the date picker popover.

input-aria-label

string

''

This property sets the ARIA label associated with this input.

input-id

string

generateId('som-date-picker-input')

This property can be used to specifically set an ID to the input field. If an ID is not provided, it will be dynamically generated.

label

string

''

This property sets the input label.

label-class

string

''

This property is a list of CSS classes that can be used to style the label.

max-date

string

''

This property shows the maximum date that can be selected.

min-date

string

''

This property shows the minimum date that can be selected.

name

string

''

This property sets the input name, used when submitting the form.

placeholder

string

''

This property sets the input placeholder text.

readonly

boolean

false

When set to true, this boolean ensures that the input will be read only.

required

boolean

false

This boolean sets the input to required.

required-ind

"none" | "optional" | "required"

This property is used to override the required indicator. By default, forms elements will show an optional indicator but some forms are better served showing the required indicator instead.

single-month-view

boolean

false

This boolean displays only one month at a time.

tooltip

string

null

This property is used to set the tooltip text.

value

string

''

This property sets the value of the input.

vertical-position

"bottom" | "top"

'bottom'

This property sets the vertical position of the date picker popover.

Methods

NameReturnsDocs

resetValue

Promise<void>

This method resets the date picker value to null.

Events

EventDetailDocs

dateChanged

any

This event is fired whenever a new date is selected.

Slots

NameDocs

label

Label for the date picker input. Alternatively, you can use the label attribute.

Anatomy

Date picker

An image of a date range picker in a popover and date picker input with components labeled as written below. An image of a date range picker in a popover and date picker input with components labeled as written below.
  1. Date picker: The calendar used to pick a date.
  2. Date picker input: An input used to collect and display a date selection.
  3. Month label: Shows the active month and year.
  4. Day label: Labels the day of the week for a column in the calendar.
  5. Navigation button: Toggles between months.
  6. Selection indicator: Shows which date has been selected.
  7. Date button: A clickable representation of dates in a month.
  8. Popover: A common collapsible container for date picker components

Date range picker

An image of a date range picker in a popover and date picker input with components labeled as written below.

The date range picker shares most of the same components as a date picker with the addition of the following:

  1. Date range picker: A calendar used to select a date range.
  2. Date range start: The first selected date in a date range.
  3. Date range end: The last date selected in a date range.
  4. Range selection indicator: Shows selected dates between a start and end date.

Calendar

Date picker calendars allow users to select a date contextually. For single date selections, one calendar is used. For selections of date ranges, two calendars may be visible in case a selection crosses into a second month.

An image of a date picker calendar showing two months – August and September of 2025.

A date picker calendar with two months shown at once.

Date picker input

The date picker input component is an input with an appended calendar icon. When focused, the date picker input opens a popover containing a date picker or a date range picker.

An image of a focused date picker input with an open date picker popover showing the month of March 2025.

A focused date picker input with an open date picker popover.

Input tooltips

Add a tooltip by setting the tooltip attribute to the desired text. Use tooltips sparingly, and keep text brief and supplementary. Do not include interactive elements. The tooltip appears on hover or keyboard focus.

Format must be in MM/DD/YYYY.
Sun
Mon
Tue
Wed
Thu
Fri
Sat
Sun
Mon
Tue
Wed
Thu
Fri
Sat
March 1984
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
April 1984
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
May 1984
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
June 1984
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

Containers

While not required, date pickers are usually placed inside containers such as popovers. This allows calendars to be separated from other content to avoid confusion or be collapsed and nested, so they are out of the way until needed.

An image of a date picker inside a popover triggered by a date picker input within a form.
Do nest date pickers inside popovers to conserve space.
An image of a date picker improperly separated from it’s control. Both the input and the calendar are placed in their own cards with no visual relationship, which confuses users.
Don’t visually separate a date picker from its control.

How to use

Use a date picker:

  • For scheduling purposes
  • If it would be helpful for the date to be shown in context, such as in relation to the day of the week or proximity to the current date
  • If the date being selected occurred recently or is in the near future

Use a date range picker if one or all the above conditions are met, but a user needs to select a range between two dates rather than a single date.

Date pickers use the standard American date format: MM/DD/YYYY. Since our audience is primarily people living within the U.S., this should not be changed.

Users should always be allowed to type in their desired date or date range manually, so be sure that the date picker is not the only way a user can input a date.

Don't rely exclusively on date pickers when collecting distant dates such as birthdays. It is frustrating for users to have to scroll to their birth year.

An image of a date picker input receiving focus by the user’s cursor. The user has partially typed a date inside the input.
Do allow users to manually type dates into a field.
An image of a date picker without an input to type a date. The user has navigated to March 1995 by repeatedly clicking the previous month navigation button, which is a bad user experience.
Don’t force users to scroll for a long time to find a date in the distant past.

Behavior

Date pickers show the current month by default and, in the case of a multi-month date picker or a date range picker, will show the next month as well. Date pickers allow users to navigate between months and select dates, but it’s best to not use them for dates far into the future or long since past, such as birthdays. An input should be provided in these cases instead.

An image showing all the selection states for the day buttons in date and date range pickers as listed below.

Unselected and selected date selection states. Note: Dates between the start and end date in a range selection are also considered selected.

An image of the interactive states for date buttons, as listed below.
  • Default: The standard state of a date button.
  • Hover: When the cursor moves over a date without clicking it.
  • Focus: When a user highlights a date button with a keyboard. The focus state looks different when selected vs. unselected.
  • Disabled: A date that falls before a minimum date or after a maximum date.

Modifiers

Minimum and maximum dates can be used to limit possible user selections. Once set, only dates set after the min and before the max date will be selectable. All dates which fall outside of this range will be disabled.

For example, if a user is trying to schedule an appointment, a minimum date of “today” will prevent invalid appointments. Similarly, if an action has a deadline, a max date will prevent users from selecting a date beyond the deadline.

An image of a date picker with a min date set. A cursor is hovering a disabled date button, which has changed to reflect the disabled status.
Use relevant minimum and maximum dates to make selection easier.
An image of a date picker with an invalid date selection showing an error state.
Don’t allow users to make invalid selections, such as a future date when requesting a past date.

Date picker interactions

Mouse

  • Clicking the calendar navigation arrows will change the visible month.
  • Clicking a date button will select or deselect a date.
  • Clicking a different date will change the selection.

Keyboard focus

  • The tab key focuses into the date picker, beginning on the first month navigation button. Tabbing again will jump to the next month navigation button. Using an arrow key enters the calendar.
  • Arrow keys navigate between dates in the calendar.
  • Enter or space selects/deselects a date.
  • Tab or Esc exits the calendar.

Date range picker interactions

Mouse

  • Clicking into the input activates the cursor and allows typing.
  • The date picker popover also opens for users.
  • Clicking outside closes the date picker popover and removes focus from the input.

Keyboard focus

  • Tabbing to the input focuses on the input and allows text entry.
  • Pressing the down arrow key opens the date picker popover. The date picker can be navigated as described above.

Layout

Date picker and date range picker size

The height and width of a date picker and date range picker is set by default. If there is not enough room for both calendars in date range picker, only one is shown.

An image of a date picker with two visible calendars inside a container. The second container does not fit and overlaps the boundary of the container. This overlap is highlighted in red.
Don’t display more than one calendar if there is insufficient space to do so.

Date picker input size

The size of a date picker input is determined just like a standard input. On mobile devices, date pickers inside popovers grow to the full width of the screen.

Inline vs. nested

Date pickers can be placed inline or nested inside of popovers.

  • When used inline, follow the standard rules for designing forms.
  • Do not place separate date pickers next to one another horizontally, as this might confuse users.
  • When nested inside a popover, place the control in accordance with rules for designing forms. The popover will open on top of other content where it has room.
An image of two different date pickers placed horizontally next to one another. There is insufficient visual distinction between the two, and a user may not realize that they are separate from one another.
Don’t place unrelated date pickers next to one another inline.
Get in touch

Do you have an idea, or want to help us improve this page? Reach out to us via email.

DTMB-DG-Support@michigan.gov

Need help? Visit our Support page to learn how to get assistance, troubleshoot issues, and connect with the team.