Skip to content

DatePicker

Props

API reference for DatePicker. For usage examples, see the React tab.

DatePicker

NameTypeDefault
childrenChildrenOrFunction<DatePickerRenderProps>

The children of the component. A function may be provided to alter the children based on component state.

defaultFocusedValueDateValue | null

The date that is focused when the calendar first mounts (uncontrolled).

defaultOpenboolean

Whether the overlay is open by default (uncontrolled).

descriptionstring
firstDayOfWeek"fri" | "mon" | "sat" | "sun" | "thu" | "tue" | "wed"

The day that starts the week.

focusedValueDateValue | null

Controls the currently focused date within the calendar.

granularityGranularity

Determines the smallest unit that is displayed in the date picker. By default, this is "day" for dates, and "minute" for times.

hideOutsideDaysbooleanfalse

Hides days that belong to the previous or next month. The cells stay in the grid so week columns remain aligned.

hideTimeZonebooleanfalse

Whether to hide the time zone abbreviation.

hourCycle12 | 24

Whether to display the time in 12 or 24 hour format. By default, this is determined by the user's locale.

isDateHighlighted((date: T) => boolean)
isDateUnavailable((date: DateValue) => boolean)

Callback that is called for each date of the calendar. If it returns true, then the date is unavailable.

isDisabledboolean

Whether the input is disabled.

isInvalidboolean

Whether the input value is invalid.

isOpenboolean

Whether the overlay is open by default (controlled).

isReadOnlyboolean

Whether the input can be selected but not changed by the user.

isRequiredboolean

Whether user input is required on the input before form submission.

labelstring
maxValueDateValue | null

The maximum allowed date that a user may select.

minValueDateValue | null

The minimum allowed date that a user may select.

pageBehaviorPageBehaviorvisible

Controls the behavior of paging. Pagination either works by advancing the visible page by visibleDuration (default) or one unit of visibleDuration.

placeholderValueDateValue | null

A placeholder date that influences the format of the placeholder shown when no value is selected. Defaults to today's date at midnight.

shouldCloseOnSelectboolean | (() => boolean)true

Determines whether the date picker popover should close automatically when a date is selected.

shouldForceLeadingZerosboolean

Whether to always show leading zeros in the month, day, and hour fields. By default, this is determined by the user's locale.

sizeDateFieldSize"md"

Controls field height, padding, and segment typography.

visibleDurationDateDuration{ months: 1 }

The amount of days that will be displayed at once. This affects how pagination works.

compactDeprecatedboolean

Use size="md" instead. This prop is a no-op.

DateField.Root

NameTypeDefault
childrenChildrenOrFunction<DatePickerRenderProps>

The children of the component. A function may be provided to alter the children based on component state.

defaultFocusedValueDateValue | null

The date that is focused when the calendar first mounts (uncontrolled).

defaultOpenboolean

Whether the overlay is open by default (uncontrolled).

descriptionstring
firstDayOfWeek"fri" | "mon" | "sat" | "sun" | "thu" | "tue" | "wed"

The day that starts the week.

focusedValueDateValue | null

Controls the currently focused date within the calendar.

granularityGranularity

Determines the smallest unit that is displayed in the date picker. By default, this is "day" for dates, and "minute" for times.

hideOutsideDaysbooleanfalse

Hides days that belong to the previous or next month. The cells stay in the grid so week columns remain aligned.

hideTimeZonebooleanfalse

Whether to hide the time zone abbreviation.

hourCycle12 | 24

Whether to display the time in 12 or 24 hour format. By default, this is determined by the user's locale.

isDateHighlighted((date: T) => boolean)
isDateUnavailable((date: DateValue) => boolean)

Callback that is called for each date of the calendar. If it returns true, then the date is unavailable.

isDisabledboolean

Whether the input is disabled.

isInvalidboolean

Whether the input value is invalid.

isOpenboolean

Whether the overlay is open by default (controlled).

isReadOnlyboolean

Whether the input can be selected but not changed by the user.

isRequiredboolean

Whether user input is required on the input before form submission.

labelstring
maxValueDateValue | null

The maximum allowed date that a user may select.

minValueDateValue | null

The minimum allowed date that a user may select.

pageBehaviorPageBehaviorvisible

Controls the behavior of paging. Pagination either works by advancing the visible page by visibleDuration (default) or one unit of visibleDuration.

placeholderValueDateValue | null

A placeholder date that influences the format of the placeholder shown when no value is selected. Defaults to today's date at midnight.

shouldCloseOnSelectboolean | (() => boolean)true

Determines whether the date picker popover should close automatically when a date is selected.

shouldForceLeadingZerosboolean

Whether to always show leading zeros in the month, day, and hour fields. By default, this is determined by the user's locale.

sizeDateFieldSize"md"

Controls field height, padding, and segment typography.

visibleDurationDateDuration{ months: 1 }

The amount of days that will be displayed at once. This affects how pagination works.

compactDeprecatedboolean

Use size="md" instead. This prop is a no-op.

DateField.Calendar

NameTypeDefault
defaultFocusedValueDateValue | null

The date that is focused when the calendar first mounts (uncontrolled).

firstDayOfWeek"fri" | "mon" | "sat" | "sun" | "thu" | "tue" | "wed"

The day that starts the week.

focusedValueDateValue | null

Controls the currently focused date within the calendar.

hideOutsideDaysbooleanfalse

Hides days that belong to the previous or next month. The cells stay in the grid so week columns remain aligned.

isDateHighlighted((date: T) => boolean)
pageBehaviorPageBehaviorvisible

Controls the behavior of paging. Pagination either works by advancing the visible page by visibleDuration (default) or one unit of visibleDuration.

visibleDurationDateDuration{ months: 1 }

The amount of days that will be displayed at once. This affects how pagination works.

DateField.Description

NameTypeDefault
aboutstring
accessKeystring
autoSavestring
childrenReactNode
colorstring
contentstring
contextMenustring
dangerouslySetInnerHTML{ __html: string | TrustedHTML; }
datatypestring
defaultCheckedboolean
elementTypestring
exportpartsstring

See: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/exportparts (opens in new tab)

inlistany
inputMode"decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url"

Hints at the type of data that might be entered by the user while editing the element or its contents

See: https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute (opens in new tab)

itemIDstring
itemPropstring
itemRefstring
itemScopeboolean
itemTypestring
partstring

See: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/part (opens in new tab)

prefixstring
propertystring
radioGroupstring
relstring
resourcestring
resultsnumber
revstring
securitystring
titlestring
typeofstring
unselectable"off" | "on"
vocabstring

DateField.FieldError

NameTypeDefault
childrenChildrenOrFunction<FieldErrorRenderProps>

The children of the component. A function may be provided to alter the children based on component state.

elementTypestring'span'

The HTML element type to render. Defaults to 'span'. Set to 'div' when using block-level children (e.g. <ul>) to avoid invalid HTML.

DateField.InputGroup

NameTypeDefault
aboutstring
accessKeystring
autoSavestring
childrenChildrenOrFunction<GroupRenderProps>

The children of the component. A function may be provided to alter the children based on component state.

colorstring
contentstring
contextMenustring
dangerouslySetInnerHTML{ __html: string | TrustedHTML; }
datatypestring
defaultCheckedboolean
exportpartsstring

See: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/exportparts (opens in new tab)

inlistany
inputMode"decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url"

Hints at the type of data that might be entered by the user while editing the element or its contents

See: https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute (opens in new tab)

itemIDstring
itemPropstring
itemRefstring
itemScopeboolean
itemTypestring
partstring

See: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/part (opens in new tab)

prefixstring
propertystring
radioGroupstring
relstring
resourcestring
resultsnumber
revstring
securitystring
sizeDateFieldSizemd

Controls field height, padding, and segment typography.

titlestring
typeofstring
unselectable"off" | "on"
vocabstring
compactDeprecatedboolean

Use size="md" instead. This prop is a no-op.

DateField.Label

NameTypeDefault
aboutstring
accessKeystring
autoSavestring
childrenReactNode
colorstring
contentstring
contextMenustring
dangerouslySetInnerHTML{ __html: string | TrustedHTML; }
datatypestring
defaultCheckedboolean
elementTypestring
exportpartsstring

See: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/exportparts (opens in new tab)

htmlForstring
inlistany
inputMode"decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url"

Hints at the type of data that might be entered by the user while editing the element or its contents

See: https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute (opens in new tab)

isDisabledboolean

Whether the Label is on a disabled input or element.

isRequiredboolean

Whether the Label is on a required input or element.

itemIDstring
itemPropstring
itemRefstring
itemScopeboolean
itemTypestring
partstring

See: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/part (opens in new tab)

prefixstring
propertystring
radioGroupstring
relstring
resourcestring
resultsnumber
revstring
securitystring
titlestring
typeofstring
unselectable"off" | "on"
vocabstring

DateField.Popover

NameTypeDefault
children (required)ReactNode

The content rendered inside the popover.

arrowBoundaryOffsetnumber0

The minimum distance the arrow's edge should be from the edge of the overlay element.

arrowRefRefObject<Element | null>

A ref for the popover arrow element.

boundaryElementElementdocument.body

Element that that serves as the positioning boundary.

containerPaddingnumber12

The placement padding that should be applied between the element and its surrounding container.

crossOffsetnumber0

The additional offset applied along the cross axis between the element and its anchor element.

defaultOpenboolean

Whether the overlay is open by default (uncontrolled).

getTargetRect((target: Element) => DOMRect | null)target.getBoundingClientRect()

Overrides the target element's bounding rectangle. Useful for positioning relative to a specific point such as the mouse cursor (e.g. context menus) or text selection.

isEnteringboolean

Whether the popover is currently performing an entry animation.

isExitingboolean

Whether the popover is currently performing an exit animation.

isKeyboardDismissDisabledbooleanfalse

Whether pressing the escape key to close the popover should be disabled.

Most popovers should not use this option. When set to true, an alternative way to close the popover with a keyboard must be provided.

isNonModalboolean

Whether the popover is non-modal, i.e. elements outside the popover may be interacted with by assistive technologies.

Most popovers should not use this option as it may negatively impact the screen reader experience. Only use with components such as combobox, which are designed to handle this situation carefully.

isOpenboolean

Whether the overlay is open by default (controlled).

maxHeightnumber

The maxHeight specified for the overlay element. By default, it will take all space up to the current viewport height.

offsetnumber8

The additional offset applied along the main axis between the element and its anchor element.

placementPlacements

The placement of the element with respect to its anchor element.

scrollRefRefObject<Element | null>overlayRef

A ref for the scrollable region within the overlay.

shouldFlipbooleantrue

Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.

shouldSkipAnimationboolean

Whether the popover should appear and disappear without an entry or exit animation. This is used by components such as PreviewTrigger to skip animations when quickly swapping between overlays.

shouldUpdatePositionbooleantrue

Whether the overlay should update its position automatically.

triggerstring

The name of the component that triggered the popover. This is reflected on the element as the data-trigger attribute, and can be used to provide specific styles for the popover depending on which element triggered it.

triggerRefRefObject<Element | null>

The ref for the element which the popover positions itself with respect to.

When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc., this is set automatically. It is only required when used standalone.