Skip to main content

DatePicker

Allow users to select a specific date.

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?

(event: <"s-divider">) => void
(event: <"s-divider">) => void
(event: <"s-divider">) => void
(event: <"s-divider">) => void
Was this section helpful?

Code

<s-button command="--show" commandFor="date-picker">
Show
</s-button>
<s-date-picker
id="date-picker"
value="2024-05-08"
onChange={onDateChange}
/>

Preview