Date Picker

A date picker component with range and presets.

Was this example helpful?

Usage#


Code
import { DatePicker } from "@medusajs/ui"
Code
<DatePicker />

API Reference#


PropTypeDefault
aria-describedby
string
-
aria-details
string
-
aria-label
string
-
aria-labelledby
string
-
autoFocus
boolean
-
defaultOpen
boolean
-
description
ReactNode
-
errorMessage
ReactNode
|
function
-
hideTimeZone
boolean
-
hourCycle
12
|24
-
id
string
-
isDisabled
boolean
-
isInvalid
boolean
-
isOpen
boolean
-
isReadOnly
boolean
-
isRequired
boolean
-
label
ReactNode
-
name
string
-
onBlur
function
-
onFocus
function
-
onFocusChange
function
-
onKeyDown
function
-
onKeyUp
function
-
onOpenChange
function
-
pageBehavior
PageBehavior
-
placeholderValue
CalendarDate
|
CalendarDateTime
-
shouldForceLeadingZeros
boolean
-
validate
function
-
validationBehavior
"aria"
|"native"
-
Was this helpful?

Examples#


Controlled Date Picker#

Manage and store the value of the date picker in a state variable for controlled behavior. This is also useful for form integration.

Selected date: 8/11/2025
Was this example helpful?

Date Picker With Time#

Enable time selection with different granularity levels for precise scheduling.

Was this example helpful?

Min/Max Values#

Restrict date selection to a specific range by setting minimum and maximum values.

In the example below, you can only select dates within the next 30 days. Dates outside the range are disabled.

Was this example helpful?

Disabled Dates#

Disable specific dates like weekends and holidays to prevent selection of unavailable dates.

The example below disables weekends and holidays like Christmas.

Was this example helpful?

Granularity Options#

Different levels of time precision from date-only to second-precision selection.

Date Only
Date and Time with Hour Precision
Date and Time with Minute Precision
Date and Time with Second Precision
Was this example helpful?

Form Integration#

The following example shows how to use the date picker in a form, with simulated form submission.

Schedule Event

Set up your event and reminder dates

Was this example helpful?
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break