Date picker
Enable users to select a single date from a visual calendar interface.
Components | Purpose | Usage guideline |
---|---|---|
Date Picker Component | Provide a highly customizable date picker that seamlessly integrates with the application's design and functionality. | Consider when customization, advanced features, specific user interactions, or complex data handling are crucial. |
Browser-owned Date Picker | Offer a familiar, accessible, and cross-browser compatible date picker with minimal development effort. | Recommended for most use cases involving basic date selection where extensive customization and advanced features are not required. |
#Examples
Date pickers simplify date input, making it especially useful for scheduling reports or filtering data. They offer a user-friendly alternative to manual text entry, reducing errors and ensuring consistent formatting.
The Date picker consists of:
- Calendar view: A visual representation of a month or multiple months, allowing users to navigate and select a date.
- Navigation controls: Arrows or buttons to move between months or years.
- Today button: Quickly selects the current date.
#Basic usage
const [value, setValue] = useState(new Date(2000, 1, 1));
return (
<DatePicker value={value} onChange={(d) => setValue(d as Date)} translations={translations} />
);
#Properties
#DatePicker
Property | Description | Defined | Value |
---|---|---|---|
valueRequired | | date | date[] Selected value | ||
onChangeRequired | function Callback for updating the value | ||
translationsRequired | object Translation keys | ||
minDateOptional | date Min for date range | ||
maxDateOptional | date Max for date range | ||
tileClassNameOptional | | string | string[] | function | ||
minDetailOptional | "century" | "decade" | "month" | "year" | ||
showNeighboringMonthOptional | boolean |
#Guidelines
#Best practices
#Do not use when
#Accessibility
Explore detailed guidelines for this component: Accessibility Specifications
#Writing
#Notable Changes
#Version 69.0.0
The DatePickerWithInput
component has been removed. Use Input Field with type="date"
instead.