--- title: "Datepicker" slug: datepicker category: component type: technical-information version: 20.0.0 tokens: 1008 source: https://ovh.github.io/design-system/v20.0.0/llms/react-components-datepicker--technical-information.txt --- # Datepicker ## Datepicker This component extends all the native `
` attributes. | Property | Type | Required | Default | Description | |---|---|---|---|---| | `dateFormatter` | `(arg: DatepickerFormatterArg) => string` | No | undefined | Format the date to display in the input. | | `defaultOpen` | `boolean` | No | undefined | The initial open state of the datepicker. Use when you don't need to control the open state of the datepicker. | | `defaultValue` | `string | Date` | No | undefined | The initial selected date. Use when you don't need to control the selected date of the datepicker. | | `defaultView` | `'month' | 'day' | 'year'` | No | undefined | The default view of the calendar (day, month, year). | | `disabled` | `boolean` | No | undefined | Whether the component is disabled. | | `disabledDates` | `Date[]` | No | undefined | List of dates that cannot be selected. | | `disabledWeekDays` | `DATEPICKER_DAY[]` | No | undefined | List of week days that cannot be selected. | | `i18n` | `Partial` | No | undefined | Internal translations override (see Input i18n keys). | | `invalid` | `boolean` | No | undefined | Whether the component is in error state. | | `locale` | `string` | No | undefined | The locale to use when formatting the date. | | `max` | `string | Date` | No | undefined | The maximum date that can be selected. | | `maxView` | `'month' | 'day' | 'year'` | No | undefined | The maximum view of the calendar (day, month, year). | | `min` | `string | Date` | No | undefined | The minimum date that can be selected. | | `minView` | `'month' | 'day' | 'year'` | No | undefined | The minimum view of the calendar (day, month, year). | | `name` | `string` | No | undefined | The name of the form element. Useful for form submission. | | `onOpenChange` | `(detail: DatepickerOpenChangeDetail) => void` | No | undefined | Callback fired when the datepicker open state changes. | | `onValueChange` | `(detail: DatepickerValueChangeDetail) => void` | No | undefined | Callback fired when the value changes. | | `open` | `boolean` | No | undefined | The controlled open state of the datepicker. | | `overlayConfig` | `object` | No | undefined | The overlay configuration. | | `placeholder` | `string` | No | undefined | The placeholder text to display in the input. | | `positionerStyle` | `CSSProperties` | No | undefined | Custom style applied to the overlay positioner. Useful if you want to override the overlay z-index. | | `readOnly` | `boolean` | No | undefined | Whether the component is readonly. | | `required` | `boolean` | No | undefined | Whether the component is required. | | `value` | `string | null | Date` | No | undefined | The controlled selected date. | | `view` | `'month' | 'day' | 'year'` | No | undefined | The controlled view of the calendar (day, month, year). | ## DatepickerContent This component extends all the native `
` attributes. | Property | Type | Required | Default | Description | |---|---|---|---|---| | `createPortal` | `boolean` | No | undefined | Whether the component should be rendered in the DOM close to the body tag. | ## DatepickerControl This component extends all the native `` attributes. | Property | Type | Required | Default | Description | |---|---|---|---|---| | `clearable` | `boolean` | No | undefined | Whether the clear button is displayed. | | `loading` | `boolean` | No | undefined | Whether the component is in loading state. | ## Enums ### DATEPICKER_DAY - `friday` = `5` - `monday` = `1` - `saturday` = `6` - `sunday` = `0` - `thursday` = `4` - `tuesday` = `2` - `wednesday` = `3` ### DATEPICKER_VIEW - `day` = `day` - `month` = `month` - `year` = `year` ## CSS Variables | Variable | Default value | |---|---| | `--ods-datepicker-content-padding-horizontal` | `calc(var(--ods-semantic-size-space-inset-inline) / 2)` | | `--ods-datepicker-content-padding-vertical` | `calc(var(--ods-semantic-size-space-inset-block) / 2)` | | `--ods-state-is-disabled-opacity` | `var(--ods-semantic-opacity-disabled)` |