Description
- A date range captures a start date and an end date selected or entered by a user.
- Use it to let a user:
- filter table data by start and end date.
- set 2 dates that are related to each other. For example, a hotel booking.
Anatomy
There are 2 types of date range component, standard and advanced.
Standard
Size
- Both standard and advanced date range are available in S , M and L sizes.
- The calendar size is the same for each date range size.
States
Component-specific states
A date range consists of 2 date pickers, or a dropdown select with date range presets.
Learn about date picker states
Learn about dropdown select states
Variations
Advanced date range
Includes a single input (dropdown select) with date range preset options and a custom range option.
- The date input area is empty until a user selects or enters a date range.
- The advanced variation is presented as an additional option, not a replacement for existing individual options.
With simple option presets
With complex option presets (grouped)
Advanced date range behavior
Using the advanced date range
Best practices
- Allow a user to enter dates in shorthand or common formats. Convert dates to a format accepted by the database behind the scenes. See guidelines for capturing numeric data
- Do not use placeholder text as it can cause usability and accessibility issues. Use a descriptive label and hint text instead. See guidelines for using placeholder text
- Make sure the open calendar does not hide the text input.
- Highlight dates in the calendar that have an event or are unavailable.
- Change a permanently read-only date field to formatted text with no field border.
- Use manual activation for a date range. The date range calendar is displayed only when a user selects the date range using Space or Enter on the keyboard, or a mouse click.