A form control that lets users select a single date from a dropdown calendar. — <cs-date-picker>
<cs-date-picker value="2025-01-15" placeholder="YYYY/MM/DD"></cs-date-picker>
<cs-date-picker value="2025-01-15" disabled></cs-date-picker>
<cs-date-picker value="2025-01-15" invalid></cs-date-picker>
aria-describedbystringAdds aria-describedby to the calendar.
aria-labelstring
default: nullAdds an aria-label to the native control.
Use this if you don't have a visible label for this control.
aria-labelledbystringAdds aria-labelledby to the calendar.
aria-requiredboolean
default: nullSpecifies whether to add aria-required to the native control.
auto-focusboolean
default: falseIndicates whether the control should be focused as soon as the page loads, which enables the user to start typing without having to manually focus the control. Don't use this option on pages where the control may be scrolled out of the viewport.
date-disabled-reasonCalendarProps.DateDisabledReasonFunctionProvides a reason why a particular date in the calendar is not enabled (only when isDateEnabled returns false).
If provided, the date becomes focusable.
disabledbooleanSpecifies if the control is disabled, which prevents the user from modifying the value and prevents the value from being included in a form submission. A disabled control can't receive focus.
expand-to-viewportbooleanBy default, the dropdown height is constrained to fit inside the height of its next scrollable container element. Enabling this property will allow the dropdown to extend beyond that container by using fixed positioning and React Portals.
Set this property if the dropdown would otherwise be constrained by a scrollable container, for example inside table and split view layouts.
We recommend you use discretion, and don't enable this property unless necessary because fixed positioning results in a slight, visible lag when scrolling complex pages.
formatDatePickerProps.FormatThe format as it is displayed. It can take the following values:
iso: ISO 8601 format without time, e.g.: 2024-01-30 (or 2024-01)long-localized: a more human-readable, localized format, e.g.: January 30, 2024 (or January, 2024)slashed: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01)granularityCalendarProps.Granularity
default: 'day'Specifies the granularity at which users will be able to select a date.
Defaults to day.
i18n-stringsDatePickerProps.I18nStringsAn object containing all the necessary localized strings required by the component.
input-formatDatePickerProps.InputFormatSpecifies the date format to use when the format is 'long-localized' and the user needs to edit the date.
The format of the input as it is being interacted with. It can take the following values:
iso: ISO 8601 format without time, e.g.: 2024-01-30 (or 2024-01)slashed: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01)is-date-enabledCalendarProps.IsDateEnabledFunctionDefines whether a particular date is enabled in the calendar or not. If you disable a date in the calendar, users can still enter this date using a keyboard. We recommend that you also validate these constraints on the client-side and server-side as you would for other form elements.
localestring
default: 'en-US'Specifies the locale to use to render month names and determine the starting day of the week. If you don't provide this, the locale is determined by the page and browser locales. Supported values and formats are listed in the JavaScript Intl API specification.
namestringSpecifies the name of the control used in HTML forms.
next-month-aria-labelstringSpecifies an aria-label for the 'next month' button.
open-calendar-aria-labelDatePickerProps.OpenCalendarAriaLabelSpecifies a function that generates the aria-label for the 'open calendar' button. The selectedDate parameter is
a human-readable localised string representing the current value of the input.
(for example, selectedDate => 'Choose Date' + (selectedDate ? `, selected date is ${selectedDate}` : ''))
placeholderstring
default: 'YYYY/MM/DD'Specifies the placeholder text rendered when the value is an empty string.
previous-month-aria-labelstringSpecifies an aria-label for the 'previous month' button.
read-onlyboolean
default: falseSpecifies if the control is read-only, which prevents the user from modifying the value but includes it in a form submission. A read-only control can receive focus.
Do not use read-only inputs outside of a form.
start-of-weeknumber
default: 0Determines the starting day of the week. The values 0-6 map to Sunday-Saturday. By default the starting day of the week is defined by the locale, but you can use this property to override it.
today-aria-labelstringUsed as part of the aria-label for today's date in the calendar.
valuestringrequiredThe current input value, in YYYY-MM-DD format.
blurCustomEvent<null>Called when input focus is removed from the UI control.
changeCustomEvent<CalendarProps.ChangeDetail>Called whenever a user changes the input value (by typing, pasting, or selecting a value).
The event detail contains the current value of the field.
focusCustomEvent<null>Called when input focus is moved to the UI control.