Skip to main content

DatePicker

The datePicker component allows merchants to select dates using a calendar interface. Use it when merchants benefit from seeing dates in context of the full month, such as selecting dates relative to today or needing weekday context.

The component supports single dates, multiple dates, and date ranges. For tight spaces, consider using dateSpinner instead. For text date entry, use dateField.


Configure the following properties on the datePicker component.

Configure the following properties on the date picker component.

string

A unique identifier for the element.

Anchor to value
value
string
Default: ""

Current selected value.

The default means no date is selected.

If the provided value is invalid, no date is selected.

Otherwise:

  • If type="single", this is a date in YYYY-MM-DD format.
  • If type="multiple", this is a comma-separated list of dates in YYYY-MM-DD format.
  • If type="range", this is a range in YYYY-MM-DD--YYYY-MM-DD format. The range is inclusive.

The datePicker component provides event callbacks for handling user interactions. Learn more about handling events.

The date picker component provides event callbacks for handling user interactions. Learn more about handling events.

(event: <"s-date-picker">) => void

Callback when the date picker is dismissed.

Anchor to change
change
(event: <"s-date-picker">) => void

Callback when the user selects a date from the picker that is different to the current value.

Anchor to focus
focus
(event: <"s-date-picker">) => void

Callback when the date picker is revealed.

Anchor to input
input
(event: <"s-date-picker">) => void

Callback when the user selects a date from the picker.



  • Choose for calendar-based selection: Use datePicker when users benefit from seeing a calendar view, like selecting dates relative to today or needing weekday context. Use dateSpinner for tight spaces or dateField when users know the exact date.
  • Provide adequate space: Ensure sufficient spacing around the picker to avoid interfering with on-screen keyboards or other interactive elements.

Was this page helpful?