Date Picker
View as MarkdownA calendar for picking a single date, several dates, or a range of dates.
Features
Permalink to heading "Features"- Single, multiple and range selection
- Day, month and year views, switched from the calendar heading, or a month or year picker
- Dates can be typed into the input, in the format of the
locale - Keyboard navigation with the arrow keys,
Home,End,PageUpandPageDown - Minimum and maximum dates, and a check for unavailable dates
- Range presets, like "last 7 days"
- Formats dates and localizes its labels for the site language
- Submits dates Extbase maps to a
DateTime, whatever format the input shows - Works with the Field component
- Opens in a popup, or renders inline
<primitives:datePicker.root>
<primitives:datePicker.label />
<primitives:datePicker.control>
<primitives:datePicker.input />
<primitives:datePicker.clearTrigger />
<primitives:datePicker.trigger />
</primitives:datePicker.control>
<primitives:datePicker.hiddenInput />
<primitives:datePicker.positioner>
<primitives:datePicker.content>
<primitives:datePicker.view view="day">
<primitives:datePicker.viewControl view="day">
<primitives:datePicker.prevTrigger view="day" />
<primitives:datePicker.viewTrigger view="day">
<primitives:datePicker.rangeText />
</primitives:datePicker.viewTrigger>
<primitives:datePicker.nextTrigger view="day" />
</primitives:datePicker.viewControl>
<primitives:datePicker.table view="day">
<primitives:datePicker.tableHeader />
<primitives:datePicker.tableBody />
</primitives:datePicker.table>
</primitives:datePicker.view>
<primitives:datePicker.monthSelect />
<primitives:datePicker.yearSelect />
<primitives:datePicker.presetTrigger />
</primitives:datePicker.content>
</primitives:datePicker.positioner>
</primitives:datePicker.root>
The calendar has three views: day, month and year. Render the views you need inside content, each as a view with its controls and its table. The demos loop over the views. Write them out one by one if they differ. The client builds the cells, the weekday headings and the options of monthSelect and yearSelect, because they depend on the locale and the month shown. The grid of an inline date picker is therefore empty until it hydrates: showSkeleton="{true}" on the tableHeader and the tableBody of the day view shows a placeholder meanwhile (see Inline).
Installation
Permalink to heading "Installation"typo3 ui:add datePicker
Please copy the files manually from GitHub into your project: DatePicker
Read more about installing Components and Primitives.
Examples
Permalink to heading "Examples"Default value
Permalink to heading "Default value"Pass defaultValue as an ISO date (2025-06-15), a DateTimeInterface or a list of them. A Field inside a Form that is bound to an object takes the value of the property the field is named after.
With form field
Permalink to heading "With form field"Wrap the date picker in ui:field.root to share name, required and invalid state. The demo is a required date of birth field.
Range selection
Permalink to heading "Range selection"Set selectionMode="{f:constant(name: 'Jramke\FluidPrimitives\Enum\DatePickerSelectionMode::Range')}" and add an input for each end of the range, each with its index. A presetTrigger selects a range with one click. Its value is a case of the DatePickerRangePreset enum (value="{f:constant(name: 'Jramke\FluidPrimitives\Enum\DatePickerRangePreset::Last7Days')}"): ThisWeek, LastWeek, ThisMonth, LastMonth, ThisQuarter, LastQuarter, ThisYear, LastYear, Last3Days, Last7Days, Last14Days, Last30Days or Last90Days. Pick the dates of a stay in the demo, or use one of the presets.
Multiple selection
Permalink to heading "Multiple selection"Set selectionMode="{f:constant(name: 'Jramke\FluidPrimitives\Enum\DatePickerSelectionMode::Multiple')}" and cap the number of dates with maxSelectedDates. The input shows the first date, so the demo lists every selected date below it from an onValueChange callback in its entry file (see Unavailable Dates).
No dates selected
Multiple months
Permalink to heading "Multiple months"Set numOfMonths to show several months of the day view next to each other, and render one table per month with the offset of the month it shows (0 for the first, 1 for the next). The month and year views show a single table. The ui copy of content hides the days outside the visible month when numOfMonths is above 1, so no day shows up twice.
Min/max constraints
Permalink to heading "Min/max constraints"Restrict the dates that can be selected with min and max, each an ISO date (2025-06-15) or a DateTimeInterface, like a date of your model. defaultFocusedValue takes the same. The demo accepts appointments within the next 30 days.
Set inline="{true}" to render the calendar in the page, without a popup. The calendar stays open and needs no control.
Unavailable dates
Permalink to heading "Unavailable dates"isDateUnavailable, format, parse, createCalendar and the on...Change callbacks are functions, so they come from your entry file: create the DatePicker there and hand them over with the other props. The weekends of the delivery date in the demo are unavailable.
Month and year picker
Permalink to heading "Month and year picker"Set minView="{f:constant(name: 'Jramke\FluidPrimitives\Enum\DatePickerView::Month')}" for a month picker, and defaultView the same way to open on the month view. Render the views the calendar can reach: the day view is left out here. A picked month is submitted as its first day. format and parse show the input as 06/2025 and read it back. They are functions, so they come from the entry file as in Unavailable Dates. placeholder tells people what to type.
A year picker uses DatePickerView::Year for minView and defaultView, renders a single year view, and has format return String(date.year) and parse return new CalendarDate(year, 1, 1).
Native selects
Permalink to heading "Native selects"The heading of the calendar is up to you. Swap the viewTrigger of the day view for a monthSelect and a yearSelect and people pick the month and the year from the native <select> of their device. They are plain elements, so a class restyles them: here they lose their border and arrow to read like the heading. The client fills the options. Months and years outside min and max are disabled. The month and year views are not reachable without a viewTrigger, so only the day view is rendered.
Dates in forms
Permalink to heading "Dates in forms"The hiddenInput, which ui:datePicker.root renders for you, submits each selected date as the W3C date-time of its midnight (2025-06-15T00:00:00+02:00), whatever format the locale shows it in. A range or several dates submit one value per date under the same name, so end the name with [] (dates[]) for PHP to receive all of them. A date picker without a date submits an empty value under the name without [] (see Clear a property with an empty field).
Extbase maps that format to a DateTime property without any configuration. The offset is the one of the time zone PHP runs in, so the property holds the date that was picked. Extbase maps request values to DateTime, so type the property DateTime, or write a custom type converter if it is a DateTimeImmutable. Outside Extbase, new DateTimeImmutable($_POST['date']) reads the value.
Time zone
Permalink to heading "Time zone"The calendar works in the time zone of the browser: it highlights today for the person looking at it, and the presets and min/max count from there. Set timeZone (Europe/Berlin) to use another one, like the time zone of a venue. The submitted dates carry the offset of the time zone PHP runs in, whatever timeZone is set to.
Localization
Permalink to heading "Localization"Dates are formatted for the language of the site, or for the locale you pass. Every label, from the buttons and the day cells to the month and year select and the placeholder of the input, ships in English and German as a datePicker.* unit of the language file and follows the site language. Some units contain a %placeholder% that is filled in when the label renders, like the %date% of a day cell.
Pass translations to override labels for one date picker, keyed by the id of the unit without datePicker..
<ui:datePicker.root
translations="{
clearTrigger: f:translate(key: 'LLL:EXT:my_extension/Resources/Private/Language/locallang.xlf:datePicker.clear'),
dayCell: 'Pick %date%'
}"
>
...
</ui:datePicker.root>
To change a label from TypeScript, spread the translations your entry file receives and override it with a function of the state:
const datePicker = new DatePicker({
...props,
translations: { ...props.translations, dayCell: state => `Pick ${state.valueText}` },
});
API Reference
Permalink to heading "API Reference"The following tables cover the available props of the Fluid Primitives. For a full list of available client side props and methods, see the Zag.js Machine API.
datePicker.root
Permalink to heading "datePicker.root"Provides shared date picker state and wraps all related parts. Renders a <div> element.
| Name | Description | Required | Default |
|---|---|---|---|
locale | stringThe locale (BCP 47 language tag) used to format and parse dates. Inherited from the site's language. | No | - |
timeZone | stringThe IANA time zone dates are evaluated in, e.g. `Europe/Berlin`. Defaults to the time zone of the browser. | No | - |
name | stringThe `name` attribute of the underlying input. Inherited from a surrounding field when available. | No | - |
disabled | booleanWhether the date picker is disabled. Inherited from a surrounding field when available. | No | - |
readOnly | booleanWhether the date picker is read-only. Inherited from a surrounding field when available. | No | - |
required | booleanWhether the date picker is required. Inherited from a surrounding field when available. | No | - |
invalid | booleanWhether the date picker is invalid. Inherited from a surrounding field when available. | No | - |
outsideDaySelectable | booleanWhether a day outside the visible month can be selected. | No | false |
min | DateTimeInterface|stringThe minimum date that can be selected: an ISO date string (`2025-01-31`) or a `DateTimeInterface`. | No | - |
max | DateTimeInterface|stringThe maximum date that can be selected: an ISO date string (`2025-01-31`) or a `DateTimeInterface`. | No | - |
closeOnSelect | booleanWhether the calendar should close after the date selection is complete. Ignored when `selectionMode` is `multiple`. | No | true |
openOnClick | booleanWhether to open the calendar when the input is clicked. | No | false |
defaultValue | DateTimeInterface|string|DateTimeInterface[]|string[]The initial selected date(s) when rendered: an ISO date string (`2025-01-31`), a `DateTimeInterface`, or a list of them. Use when you don't need to control the selected date(s) of the date picker. Inherited from a surrounding field when available. | No | - |
defaultFocusedValue | DateTimeInterface|stringThe initially focused date when rendered: an ISO date string or a `DateTimeInterface`. Use when you don't need to control the focused date of the date picker. | No | - |
numOfMonths | integerThe number of months the day view shows next to each other. | No | - |
startOfWeek | integerThe first day of the week. `0` is Sunday, `1` is Monday, and so on. | No | 1 |
fixedWeeks | booleanWhether the calendar should render with a fixed number of weeks (6), instead of 5 or 6 depending on the month. | No | - |
showWeekNumbers | booleanWhether to show the week number column in the day view. | No | - |
selectionMode | Enum\DatePickerSelectionModeThe selection mode of the calendar: `single`, `multiple`, or `range`. | No | Single |
maxSelectedDates | integerThe maximum number of dates that can be selected. Only applicable when `selectionMode` is `multiple`. | No | - |
placeholder | stringThe placeholder text of the input. Defaults to the date format of the `locale`, e.g. `dd.mm.yyyy`. | No | - |
defaultView | Enum\DatePickerViewThe view the calendar starts in: `day`, `month`, or `year`. | No | Day |
minView | Enum\DatePickerViewThe smallest view of the calendar. `month` turns it into a month picker. | No | Day |
maxView | Enum\DatePickerViewThe largest view of the calendar. | No | Year |
positioning | arrayThe positioning options of the calendar content. | No | {
"placement": "bottom-start",
"gutter": 8
} |
defaultOpen | booleanThe initial open state of the date picker when rendered. Use when you don't need to control the open state of the date picker. | No | false |
inline | booleanWhether to render the calendar in the page, without a popup. It is always open and has no trigger. | No | false |
translations | arrayLocalized date picker labels, by the id of the `datePicker.*` units of the language file. Use `f:translate` for per-template localization overrides when needed. | No | - |
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
rootId | stringThe root ID of the component, used for hydration and identification. | No | - |
ids | arrayThe IDs of of the component parts for composition. | No | [] |
autoMount | booleanWhether the client initializes the component on its own. Set it to false to mount it yourself with `mount()` | No | true |
provider | stringThe `id` of the `.provider` this root takes its `rootId` and props from. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
Rendered data attributes
| Attribute | Description |
|---|---|
data-date-picker-root | <uid> |
data-state | "open" | "closed" |
data-disabled | Present when disabled |
data-readonly | Present when read-only |
data-empty | Present when the content is empty |
datePicker.label
Permalink to heading "datePicker.label"Labels an input. Renders a <label> element.
| Name | Description | Required | Default |
|---|---|---|---|
index | integerThe index of the input this label is for, in range mode (`0` or `1`). | No | 0 |
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
Rendered data attributes
| Attribute | Description |
|---|---|
data-date-picker-label | <uid> |
data-state | "open" | "closed" |
data-index | The index of the item |
data-disabled | Present when disabled |
data-readonly | Present when read-only |
data-invalid | Present when invalid |
datePicker.control
Permalink to heading "datePicker.control"Groups the input and the triggers. Renders a <div> element.
| Name | Description | Required | Default |
|---|---|---|---|
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
Rendered data attributes
| Attribute | Description |
|---|---|
data-date-picker-control | <uid> |
data-disabled | Present when disabled |
data-placeholder-shown | Present when placeholder is shown |
data-invalid | Present when invalid |
datePicker.input
Permalink to heading "datePicker.input"Shows the selected date as text and lets people type one. Renders an <input> element.
| Name | Description | Required | Default |
|---|---|---|---|
index | integerThe index of this input, in range mode (`0` or `1`). | No | 0 |
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
Rendered data attributes
| Attribute | Description |
|---|---|
data-date-picker-input | <uid> |
data-index | The index of the item |
data-state | "open" | "closed" |
data-placeholder-shown | Present when placeholder is shown |
data-invalid | Present when invalid |
datePicker.clearTrigger
Permalink to heading "datePicker.clearTrigger"Clears the selection. Renders a <button> element.
| Name | Description | Required | Default |
|---|---|---|---|
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
datePicker.trigger
Permalink to heading "datePicker.trigger"Opens and closes the calendar. Renders a <button> element.
| Name | Description | Required | Default |
|---|---|---|---|
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
Rendered data attributes
| Attribute | Description |
|---|---|
data-date-picker-trigger | <uid> |
data-placement | The placement of the trigger |
data-side | The side of the trigger that the trigger is positioned on |
data-state | "open" | "closed" |
data-placeholder-shown | Present when placeholder is shown |
datePicker.hiddenInput
Permalink to heading "datePicker.hiddenInput"Submits the selected dates as W3C date-times, one input per date. Renders <input type="hidden"> elements.
| Name | Description | Required | Default |
|---|---|---|---|
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
datePicker.positioner
Permalink to heading "datePicker.positioner"Positions the floating calendar. Renders a <div> element.
| Name | Description | Required | Default |
|---|---|---|---|
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
Rendered data attributes
| Attribute | Description |
|---|---|
data-date-picker-positioner | <uid> |
data-nested | Present when the positioner is nested within another {{widget}} |
data-has-nested | Present when the positioner has nested {{widget}}s |
datePicker.content
Permalink to heading "datePicker.content"The calendar surface, positioned by positioner. Renders a <div> element.
| Name | Description | Required | Default |
|---|---|---|---|
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
Rendered data attributes
| Attribute | Description |
|---|---|
data-date-picker-content | <uid> |
data-state | "open" | "closed" |
data-placement | The placement of the content |
data-side | The side of the trigger that the content is positioned on |
data-inline | Present when the content is inline |
data-nested | popover |
data-has-nested | popover |
datePicker.view
Permalink to heading "datePicker.view"Wraps one view of the calendar: day, month, or year. Renders a <div> element.
| Name | Description | Required | Default |
|---|---|---|---|
view | stringThe view this element renders: `day`, `month`, or `year`. | Yes | - |
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
Rendered data attributes
| Attribute | Description |
|---|---|
data-date-picker-view | <uid> |
data-view | The view of the view |
datePicker.viewControl
Permalink to heading "datePicker.viewControl"Groups the buttons that move through a view. Renders a <div> element.
| Name | Description | Required | Default |
|---|---|---|---|
view | stringThe view this element controls: `day`, `month`, or `year`. | Yes | - |
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
Rendered data attributes
| Attribute | Description |
|---|---|
data-date-picker-view-control | <uid> |
data-view | The view of the viewcontrol |
datePicker.prevTrigger
Permalink to heading "datePicker.prevTrigger"Moves a view back: to the previous month, year, or decade. Renders a <button> element.
| Name | Description | Required | Default |
|---|---|---|---|
view | stringThe view this element navigates: `day`, `month`, or `year`. | Yes | - |
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
Rendered data attributes
| Attribute | Description |
|---|---|
data-date-picker-prev-trigger | <uid> |
data-disabled | Present when disabled |
datePicker.nextTrigger
Permalink to heading "datePicker.nextTrigger"Moves a view forward: to the next month, year, or decade. Renders a <button> element.
| Name | Description | Required | Default |
|---|---|---|---|
view | stringThe view this element navigates: `day`, `month`, or `year`. | Yes | - |
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
Rendered data attributes
| Attribute | Description |
|---|---|
data-date-picker-next-trigger | <uid> |
data-disabled | Present when disabled |
datePicker.viewTrigger
Permalink to heading "datePicker.viewTrigger"Switches to the next larger view. Renders a <button> element.
| Name | Description | Required | Default |
|---|---|---|---|
view | stringThe view this element switches away from: `day`, `month`, or `year`. | Yes | - |
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
Rendered data attributes
| Attribute | Description |
|---|---|
data-date-picker-view-trigger | <uid> |
data-view | The view of the viewtrigger |
data-disabled | Present when disabled |
datePicker.rangeText
Permalink to heading "datePicker.rangeText"Shows the range of dates a view displays, like "June 2025". Renders a <span> element.
| Name | Description | Required | Default |
|---|---|---|---|
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
datePicker.table
Permalink to heading "datePicker.table"Wraps the grid of a view. Renders a <table> element.
| Name | Description | Required | Default |
|---|---|---|---|
view | stringThe view this table renders: `day`, `month`, or `year`. | No | 'day' |
offset | integerWhich month of the day view this table shows, counted from the first visible month: `0` for the first, `1` for the next. Only used with `numOfMonths` above `1`. | No | 0 |
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
Rendered data attributes
| Attribute | Description |
|---|---|
data-date-picker-table | <uid> |
data-columns | |
data-view | The view of the table |
datePicker.tableHeader
Permalink to heading "datePicker.tableHeader"Holds the weekday headings of the day view, built on the client. Renders a <thead> element.
| Name | Description | Required | Default |
|---|---|---|---|
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
Rendered data attributes
| Attribute | Description |
|---|---|
data-date-picker-table-header | <uid> |
data-view | The view of the tableheader |
data-disabled | Present when disabled |
datePicker.tableBody
Permalink to heading "datePicker.tableBody"Holds the days, months, or years of a view, built on the client. Renders a <tbody> element.
| Name | Description | Required | Default |
|---|---|---|---|
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
Rendered data attributes
| Attribute | Description |
|---|---|
data-date-picker-table-body | <uid> |
data-view | The view of the tablebody |
data-disabled | Present when disabled |
datePicker.monthSelect
Permalink to heading "datePicker.monthSelect"Jumps to a month, its options built on the client. Renders a <select> element.
| Name | Description | Required | Default |
|---|---|---|---|
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
datePicker.yearSelect
Permalink to heading "datePicker.yearSelect"Jumps to a year, its options built on the client. Renders a <select> element.
| Name | Description | Required | Default |
|---|---|---|---|
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
datePicker.presetTrigger
Permalink to heading "datePicker.presetTrigger"Selects a predefined range of dates. Renders a <button> element.
| Name | Description | Required | Default |
|---|---|---|---|
value | Enum\DatePickerRangePresetThe range the preset selects, like `DatePickerRangePreset::Last7Days`. | Yes | - |
attributes | arrayAdditional attributes that should be rendered on the component where ui:attributes is used. | No | [] |
asChild | booleanIf true the component uses its child only without the component template. Like Radix UI asChild or Base UI render props. | No | - |
class | stringThe CSS class(es) to be applied to the component. | No | - |
Machine JavaScript API
Permalink to heading "Machine JavaScript API"| Name | Type | Description |
|---|---|---|
focused | boolean | Whether the input is focused |
open | boolean | Whether the date picker is open |
disabled | boolean | Whether the date picker is disabled |
invalid | boolean | Whether the date picker is invalid |
readOnly | boolean | Whether the date picker is read-only |
inline | boolean | Whether the date picker is rendered inline |
numOfMonths | number | The number of months to display |
showWeekNumbers | boolean | Whether the week number column is shown in the day view |
selectionMode | SelectionMode | The selection mode (single, multiple, or range) |
maxSelectedDates | number | undefined | The maximum number of dates that can be selected (only for multiple selection mode). |
isMaxSelected | boolean | Whether the maximum number of selected dates has been reached. |
view | DateView | The current view of the date picker |
getWeekNumber | (week: DateValue[]) => number | Returns the ISO 8601 week number (1-53) for the given week (array of dates). |
getDaysInWeek | (week: number, from?: DateValue) => DateValue[] | Returns an array of days in the week index counted from the provided start date, or the first visible date if not given. |
getOffset | (duration: DateDuration) => DateValueOffset | Returns the offset of the month based on the provided number of months. |
getRangePresetValue | (value: DateRangePreset) => DateValue[] | Returns the range of dates based on the provided date range preset. |
getMonthWeeks | (from?: DateValue) => DateValue[][] | Returns the weeks of the month from the provided date. Represented as an array of arrays of dates. |
isUnavailable | (date: DateValue) => boolean | Returns whether the provided date is available (or can be selected) |
weeks | DateValue[][] | The weeks of the month. Represented as an array of arrays of dates. |
weekDays | WeekDay[] | The days of the week. Represented as an array of strings. |
visibleRange | VisibleRange | The visible range of dates. |
visibleRangeText | VisibleRangeText | The human readable text for the visible range of dates. |
value | DateValue[] | The selected date. |
valueAsDate | Date[] | The selected date as a Date object. |
valueAsString | string[] | The selected date as a string. |
focusedValue | DateValue | The focused date. |
focusedValueAsDate | Date | The focused date as a Date object. |
focusedValueAsString | string | The focused date as a string. |
selectToday | VoidFunction | Sets the selected date to today. |
setValue | (values: DateValue[]) => void | Sets the selected date to the given date. |
setTime | (time: Time, index?: number) => void | Sets the time for a specific date value. Converts CalendarDate to CalendarDateTime if needed. |
setFocusedValue | (value: DateValue) => void | Sets the focused date to the given date. |
clearValue | (options?: { focus?: boolean }) => void | Clears the selected date(s). |
setOpen | (open: boolean) => void | Function to open or close the calendar. |
focusMonth | (month: number) => void | Function to set the selected month. |
focusYear | (year: number) => void | Function to set the selected year. |
getYears | () => Cell[] | Returns the months of the year |
getYearsGrid | (props?: YearGridProps) => YearGridValue | Returns the years of the decade based on the columns. Represented as an array of arrays of years. |
getDecade | () => Range<number | undefined> | Returns the start and end years of the decade. |
getMonths | (props?: MonthFormatOptions) => Cell[] | Returns the months of the year |
getMonthsGrid | (props?: MonthGridProps) => MonthGridValue | Returns the months of the year based on the columns. Represented as an array of arrays of months. |
format | (value: DateValue, opts?: Intl.DateTimeFormatOptions) => string | Formats the given date value based on the provided options. |
setView | (view: DateView) => void | Sets the view of the date picker. |
goToNext | VoidFunction | Goes to the next month/year/decade. |
goToPrev | VoidFunction | Goes to the previous month/year/decade. |
getDayTableCellState | (props: DayTableCellProps) => DayTableCellState | Returns the state details for a given cell. |
getMonthTableCellState | (props: TableCellProps) => TableCellState | Returns the state details for a given month cell. |
getYearTableCellState | (props: TableCellProps) => TableCellState | Returns the state details for a given year cell. |
getRootState | () => RootState | Returns the state of the root. |
getContentState | () => ContentState | Returns the state of the content. |
getTriggerState | () => TriggerState | Returns the state of the trigger. |
getInputState | () => InputState | Returns the state of the input. |
Accessibility
Permalink to heading "Accessibility"| Key | Description |
|---|---|
ArrowLeft | Moves focus to the previous day within the current week. |
ArrowRight | Moves focus to the next day within the current week. |
ArrowUp | Moves focus to the same day of the week in the previous week. |
ArrowDown | Moves focus to the same day of the week in the next week. |
Home | Moves focus to the first day of the current month. |
End | Moves focus to the last day of the current month. |
PageUp | Moves focus to the same day of the month in the previous month. |
PageDown | Moves focus to the same day of the month in the next month. |
Enter | Selects the focused date and closes the date picker. |
Esc | Closes the date picker without selecting any date. |