Single Date Picker
The date picker allows users select a single date from a calendar. They can also navigate from one month to another, when selecting a date.
Unless used as the inline variant, the single date picker consists of two components: the trigger and the date picker itself. Valid trigger components would be a Button or an Input. The trigger component should always reflect the currently selected date, or a placeholder text (date format in case of an input, call to action label in case of button) if no selection has been made yet.
note
For a date range selection refer to the DateRangePicker
Usage Rules
Do
- Use if you want to enter a single date
Don't
- Use if you want to enter a date range. Instead of using two date pickers to accomplish a date range selection, use the dedicated DateRangePicker
- Use if you want to enter a specific known value, such as a birthday. Users will likely want to type that value instead of hunting for it in a date picker.
Example
Variants
Localization
The Single Date Picker has localization support. To make localization active, you can use the locale
prop.
info
Supported languages:
English (Default), Chinese, French, German, Japanese, Korean, Portuguese, Russian, Spanish, Turkish, Vietnamese
Custom Current Date
You can pass currentDate
. Its value will be assigned to "today".
Props
Name | Type | Default |
---|---|---|
onChange * This handler will be called when a date is selected |
| — |
date The selected date |
| null |
minDate The earliest date the user can select |
| — |
maxDate The latest date the user can select |
| — |
currentDate The custom date to be used as the current date. If undefined, the machine current date is used. |
| — |
locale Use this prop to set localization for the date values |
| — |
css Add custom styles to this component. Use with caution. Learn more here: Link |
| — |
inputFieldCss |
| — |
data-{foo} Data attributes can be used by testing libraries to retrieve components or assert their existence |
| — |
* - the prop is required. |