Date Picker
DatePicker
is composed of both a DateInput
and Calendar
controls, that allows users to select either a single date or a date range consisting of a start and end date, providing a flexible and intuitive way to choose dates.
Note
All date components requires LocalizationProvider to be set up in your application.
An uncontrolled DatePicker
, composed of a DateInputSingle and a Calendar component, allows users to select a single date when the selectionVariant
prop is set to "single", without requiring explicit state management in the parent component, making it ideal for simple date selection tasks.
A controlled DatePicker
, composed of a DateInputSingle and a Calendar component, allows users to select a single date when the selectionVariant
prop is set to "single", with the parent component explicitly managing the date state, providing greater control over the date selection process.
Use DatePickerSingleGridPanel
to provide a grid of multiple calendars, enabling the user to select the date from a wider range of visible months.
The columns
and numberOfVisibleMonths
properties are responsive, allowing you to adjust the number of calendars or columns at each breakpoint for optimal display on different screen sizes.
A DatePicker
with selectionVariant
set to "single", inside a FormField
, provides the field with a visible label, help text, and a status message for validation feedback.
When used with FormField
, the validationStatus
prop can be used to recreate an initial error state.
To constrain the selected date within a specific range, use the minDate
and/or maxDate
props. If minDate
is not provided, it defaults to the year 1900. If maxDate
is undefined, it defaults to the year 2100. This ensures that the selected date remains within the specified range.
Disabled dates are not selectable. To implement this, use the isDayUnselectable
prop to pass a function that determines whether a day is unselectable and provides the tooltip description.
Unselectable dates are visually distinct from selectable dates. When a user attempts to select an unselectable date, the calendar displays a tooltip with additional information. To implement this, use the isDayUnselectable
prop to pass a function that determines whether a day is unselectable and provides the tooltip description.
Highlighted dates are marked by a triangle in the top right corner, indicating an event associated with that day. When a user hovers over a highlighted date, the calendar displays a tooltip with additional information. To implement this, use the isDayHighlighted
prop to pass a function that determines whether a day is highlighted and provides the tooltip description.
The composed nature of the DatePicker
enables you to control the content of the overlay using the children
prop. Use the recommended panels or compose them with your own.
The children
prop enables you to compose additional controls to your Date Picker component, such as a 'Today' button.
You can change dates upon selection, or apply the selection with additional controls.
A custom parser can be used to handle specific date formats or shorthand date entries.
When the locale
prop is provided, the DatePicker
component uses it to define the locale, ensuring that date formats, month names, and other locale-specific elements are displayed according to the specified locale.
Use the timezone
prop to display the selected date in a specific timezone. This is particularly useful for applications that need to handle date and time data across different time zones, ensuring that users can accurately select and view dates based on their local time.
Note
If you need to work with a date string (e.g., in the YYYY-MM-DD
format) and display it using a date picker, you don't need to configure a timezone. Simply use the dateAdapter.format
and dateAdapter.parse
functions with the same format
parameter. Pass the formatted date to the selectedDate
property and retrieve the date using the onSelectionChange
callback.
To customize the rendering of a day element, pass a render
prop through the CalendarDayProps
. This can be useful for scenarios where you need to display additional information or apply custom styling to specific dates.
A DatePicker
component with a border provides a visually distinct area for selecting dates, enhancing the user interface by clearly delineating the component boundaries. This styling can improve usability and accessibility by making the calendar controls more noticeable and easier to interact with.
By default, the overlay's open state is uncontrolled and opens only when the calendar button or down arrow is used. However, it can also be configured to open using the openOnClick
prop.
By default, the overlay's open state is uncontrolled and opens only when the calendar button is pressed or down arrow is used. However, you can fully control the overlay's open behavior using the open
prop. When you control the open state, you also take responsibility for handling the input's focus behavior after a selection is made.
Note
All date components requires LocalizationProvider to be set up in your application.
An uncontrolled DatePicker
, composed of a DateInputSingle and a Calendar component, allows users to select a single date when the selectionVariant
prop is set to "single", without requiring explicit state management in the parent component, making it ideal for simple date selection tasks.
A controlled DatePicker
, composed of a DateInputSingle and a Calendar component, allows users to select a single date when the selectionVariant
prop is set to "single", with the parent component explicitly managing the date state, providing greater control over the date selection process.
Use DatePickerSingleGridPanel
to provide a grid of multiple calendars, enabling the user to select the date from a wider range of visible months.
The columns
and numberOfVisibleMonths
properties are responsive, allowing you to adjust the number of calendars or columns at each breakpoint for optimal display on different screen sizes.
A DatePicker
with selectionVariant
set to "single", inside a FormField
, provides the field with a visible label, help text, and a status message for validation feedback.
When used with FormField
, the validationStatus
prop can be used to recreate an initial error state.
To constrain the selected date within a specific range, use the minDate
and/or maxDate
props. If minDate
is not provided, it defaults to the year 1900. If maxDate
is undefined, it defaults to the year 2100. This ensures that the selected date remains within the specified range.
Disabled dates are not selectable. To implement this, use the isDayUnselectable
prop to pass a function that determines whether a day is unselectable and provides the tooltip description.
Unselectable dates are visually distinct from selectable dates. When a user attempts to select an unselectable date, the calendar displays a tooltip with additional information. To implement this, use the isDayUnselectable
prop to pass a function that determines whether a day is unselectable and provides the tooltip description.
Highlighted dates are marked by a triangle in the top right corner, indicating an event associated with that day. When a user hovers over a highlighted date, the calendar displays a tooltip with additional information. To implement this, use the isDayHighlighted
prop to pass a function that determines whether a day is highlighted and provides the tooltip description.
The composed nature of the DatePicker
enables you to control the content of the overlay using the children
prop. Use the recommended panels or compose them with your own.
The children
prop enables you to compose additional controls to your Date Picker component, such as a 'Today' button.
You can change dates upon selection, or apply the selection with additional controls.
A custom parser can be used to handle specific date formats or shorthand date entries.
When the locale
prop is provided, the DatePicker
component uses it to define the locale, ensuring that date formats, month names, and other locale-specific elements are displayed according to the specified locale.
Use the timezone
prop to display the selected date in a specific timezone. This is particularly useful for applications that need to handle date and time data across different time zones, ensuring that users can accurately select and view dates based on their local time.
Note
If you need to work with a date string (e.g., in the YYYY-MM-DD
format) and display it using a date picker, you don't need to configure a timezone. Simply use the dateAdapter.format
and dateAdapter.parse
functions with the same format
parameter. Pass the formatted date to the selectedDate
property and retrieve the date using the onSelectionChange
callback.
To customize the rendering of a day element, pass a render
prop through the CalendarDayProps
. This can be useful for scenarios where you need to display additional information or apply custom styling to specific dates.
A DatePicker
component with a border provides a visually distinct area for selecting dates, enhancing the user interface by clearly delineating the component boundaries. This styling can improve usability and accessibility by making the calendar controls more noticeable and easier to interact with.
By default, the overlay's open state is uncontrolled and opens only when the calendar button or down arrow is used. However, it can also be configured to open using the openOnClick
prop.
By default, the overlay's open state is uncontrolled and opens only when the calendar button is pressed or down arrow is used. However, you can fully control the overlay's open behavior using the open
prop. When you control the open state, you also take responsibility for handling the input's focus behavior after a selection is made.
Note
All date components requires LocalizationProvider to be set up in your application.
An uncontrolled DatePicker
, composed of a DateInputSingle and a Calendar component, allows users to select a single date when the selectionVariant
prop is set to "single", without requiring explicit state management in the parent component, making it ideal for simple date selection tasks.
A controlled DatePicker
, composed of a DateInputSingle and a Calendar component, allows users to select a single date when the selectionVariant
prop is set to "single", with the parent component explicitly managing the date state, providing greater control over the date selection process.
Use DatePickerSingleGridPanel
to provide a grid of multiple calendars, enabling the user to select the date from a wider range of visible months.
The columns
and numberOfVisibleMonths
properties are responsive, allowing you to adjust the number of calendars or columns at each breakpoint for optimal display on different screen sizes.
A DatePicker
with selectionVariant
set to "single", inside a FormField
, provides the field with a visible label, help text, and a status message for validation feedback.
When used with FormField
, the validationStatus
prop can be used to recreate an initial error state.
To constrain the selected date within a specific range, use the minDate
and/or maxDate
props. If minDate
is not provided, it defaults to the year 1900. If maxDate
is undefined, it defaults to the year 2100. This ensures that the selected date remains within the specified range.
Disabled dates are not selectable. To implement this, use the isDayUnselectable
prop to pass a function that determines whether a day is unselectable and provides the tooltip description.
Unselectable dates are visually distinct from selectable dates. When a user attempts to select an unselectable date, the calendar displays a tooltip with additional information. To implement this, use the isDayUnselectable
prop to pass a function that determines whether a day is unselectable and provides the tooltip description.
Highlighted dates are marked by a triangle in the top right corner, indicating an event associated with that day. When a user hovers over a highlighted date, the calendar displays a tooltip with additional information. To implement this, use the isDayHighlighted
prop to pass a function that determines whether a day is highlighted and provides the tooltip description.
The composed nature of the DatePicker
enables you to control the content of the overlay using the children
prop. Use the recommended panels or compose them with your own.
The children
prop enables you to compose additional controls to your Date Picker component, such as a 'Today' button.
You can change dates upon selection, or apply the selection with additional controls.
A custom parser can be used to handle specific date formats or shorthand date entries.
When the locale
prop is provided, the DatePicker
component uses it to define the locale, ensuring that date formats, month names, and other locale-specific elements are displayed according to the specified locale.
Use the timezone
prop to display the selected date in a specific timezone. This is particularly useful for applications that need to handle date and time data across different time zones, ensuring that users can accurately select and view dates based on their local time.
Note
If you need to work with a date string (e.g., in the YYYY-MM-DD
format) and display it using a date picker, you don't need to configure a timezone. Simply use the dateAdapter.format
and dateAdapter.parse
functions with the same format
parameter. Pass the formatted date to the selectedDate
property and retrieve the date using the onSelectionChange
callback.
To customize the rendering of a day element, pass a render
prop through the CalendarDayProps
. This can be useful for scenarios where you need to display additional information or apply custom styling to specific dates.
A DatePicker
component with a border provides a visually distinct area for selecting dates, enhancing the user interface by clearly delineating the component boundaries. This styling can improve usability and accessibility by making the calendar controls more noticeable and easier to interact with.
By default, the overlay's open state is uncontrolled and opens only when the calendar button or down arrow is used. However, it can also be configured to open using the openOnClick
prop.
By default, the overlay's open state is uncontrolled and opens only when the calendar button is pressed or down arrow is used. However, you can fully control the overlay's open behavior using the open
prop. When you control the open state, you also take responsibility for handling the input's focus behavior after a selection is made.