Date Picker

Lab component

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.

Density
Mode

An uncontrolled DatePicker, composed of a DateInput 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.

An uncontrolled DatePicker, composed of a DateInput and a Calendar component, allows users to select a date range when the selectionVariant prop is set to "range", without requiring explicit state management in the parent component, making it ideal for selecting start and end dates for various applications.

A controlled DatePicker, composed of a DateInput 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.

A controlled DatePicker, composed of a DateInput and a Calendar component, allows users to select a date range when the selectionVariant prop is set to "range", with the parent component explicitly managing the start and end date states, providing greater control over the date range selection process.

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.

A DatePicker with selectionVariant set to "range", 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.

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.

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.

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 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.

When the children prop is used, the DatePicker component allows consumers to customize the overlay content. In this example, we add a custom panel for quick date selection.

You can change dates upon selection, or apply the selection with additional controls.

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.

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.

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.

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.