Skip to main content

DatePicker

Allows merchants to select a specific date, using a calendar-like picker interface.

string

A unique identifier for the element.

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.
Was this section helpful?

Learn more about registering events

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

Callback when the date picker is dismissed.

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

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

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

Callback when the date picker is revealed.

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

Callback when the user selects a date from the picker.

Was this section helpful?

Code

<s-button command="--show" commandFor="date-picker">
Show
</s-button>
<s-date-picker
id="date-picker"
value="2025-10-08"
/>

Preview

DatePicker usage patterns

Show and hide DatePicker using button commands

Handle date selection events

Was this section helpful?

Command system

<>
<s-button command="--show" commandFor="date-picker">
Select Date
</s-button>
<s-date-picker
id="date-picker"
value="2024-10-26"
onChange={(event) => console.log('Date selected:', event.target.value)}
/>
</>;