Date Picker

Enter a date, time, or range directly, or choose it from a calendar.

Live preview
Interact with the component to see results here.
View code
HTML
<sy-datepicker
  variant="date"
  mode="day"
  placeholder="Select date"
  format="yyyy-MM-dd"
  year="2026"
  month="10"
  day="15"
  hour="09"
  minute="30"
  second="00"
  name="date"
  id="sample"
  aria-label="Select date"
></sy-datepicker>

Usage guide

#

Use for date and time selection. Choose variant to match the required value.

  1. Write the error message in the error slot.

    Inside the component, add <span slot="error">Error message</span>. You can include links and other guidance as well as text. For inputs supporting noNativeValidity, enable it to show this guidance instead of a browser popup. Switch always displays errors below the component.

  2. Report business rule failures with setCustomError().

    For example, if the server rejects a duplicate value, update the error slot and call setCustomError(). This method does not take a message argument. A custom error also blocks form submission.

  3. Clear the error after resolving it and check whether submission is allowed.

    Use clearCustomError() to clear a business rule error. Required-field and format validation remain active. await checkValidity() returns true or false; reportValidity() validates and displays errors. Read valid named values through FormData on submission.

Date

Use date. Set the day, month, or year selection unit with mode.

Date and time

Use datetime to select both a date and a time.

Range

Use range to collect a start and end date.

Time

Use time to select a time without a date.

Display and form integration
format uses yyyy, MM, dd, hh, mm, and ss. Connect forms with name and required. selected reports confirmed selection; changed reports input changes.

Feature examples

#

Choose a feature from 14 topics. Explore property settings, method calls, event results, and slot layouts through live examples and code.

Usage examples · Overview

Try the selected example. Topics with multiple configurations let you switch between detailed examples.

View code
HTML
Loading the example.

Property · Date

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Date Names

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Disabled

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Format

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Hide Weekend

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Mode

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Monday Start

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Placeholder

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Readonly

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Variant

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Methods · setCustomError

Use the example's buttons to call methods and inspect their results.

View code
HTML
Loading the example.

Events · Changed

Interact with the component to see event names and payloads in the live preview below.

View code
HTML
Loading the example.

Events · Selected

Interact with the component to see event names and payloads in the live preview below.

View code
HTML
Loading the example.

API reference

#

Hover over a name or focus it with the keyboard to see the code. On touch screens, tap the name.

<sy-datepicker>

Properties

Attribute / PropertyTypeDefaultDescription
'day' | 'month' | 'year''day'Date selection unit: day, month, or year.
'date' | 'datetime' | 'range' | 'time''date'Selection type: date, date and time, range, or time.
booleanfalseBlock user interaction and keyboard focus.
booleanfalseDisplay the current value while preventing edits.
booleanfalseFail form validation when no value is provided.
stringundefinedYear.
stringundefinedMonth. Date Picker uses 1–12; child Calendar components use 0–11.
stringundefinedDay of the month.
stringundefinedHour, from 0 to 23.
stringundefinedMinute, from 0 to 59.
stringundefinedSecond, from 0 to 59.
string'Su,Mo,Tu,We,Th,Fr,Sa'Comma-separated weekday names, from Sunday through Saturday.
booleanfalseStart the week on Monday.
booleanfalseHide Saturdays and Sundays in the calendar.
string''Placeholder shown when the value is empty.
string'yyyy-MM-dd hh:mm:ss'Display format combining the yyyy, MM, dd, hh, mm, and ss tokens.
string''Field name used in FormData.
booleanfalseUse the app's error UI instead of the browser's built-in error display. checkValidity still performs validation.

Events

EventDetailDescription
CustomEvent<unknown>Emitted when the value or selection state changes.
CustomEvent<unknown>Emitted when the user selects an item.

Methods

MethodReturnsDescription
Promise<string>Return the current validation state.
Promise<void>Set a custom error state.
Promise<void>Clear the custom error state.
Promise<boolean>Return true if the current constraints are satisfied, otherwise false.
Promise<boolean>Validate the current value and display errors to the user.

Slots

SlotDescription
Validation error message.

<sy-calendar>

Properties

Attribute / PropertyTypeDefaultDescription
'day' | 'month' | 'year''day'Date selection unit: day, month, or year.
'date' | 'datetime' | 'range' | 'time''date'Panel to display: date, date and time, range, or time.
string'hh:mm:ss'Format used to display and parse values. See the usage guide for tokens or format values.
stringundefinedRange endpoint currently being edited: start or end.
numberundefinedYear.
numberundefinedMonth. Date Picker uses 1–12; child Calendar components use 0–11.
numberundefinedDay of the month.
numberundefinedHour, from 0 to 23.
numberundefinedMinute, from 0 to 59.
numberundefinedSecond, from 0 to 59.
{year: number, month: number, day: number }undefinedStart date of the selected range. month is zero-based.

Pass objects and arrays as JavaScript properties.

{year: number, month: number, day: number }undefinedEnd date of the selected range. month is zero-based.

Pass objects and arrays as JavaScript properties.

string'Su,Mo,Tu,We,Th,Fr,Sa'Comma-separated weekday names, from Sunday through Saturday.
booleanfalseStart the week on Monday.
booleanfalseHide Saturdays and Sundays in the calendar.

Events

EventDetailDescription
CustomEvent<unknown>Emitted when the user selects an item.
CustomEvent<unknown>Read the result from the event's detail.

<sy-date-calendar>

Properties

Attribute / PropertyTypeDefaultDescription
'day' | 'month' | 'year' | 'decade'undefinedDay, month, year, or decade view.
{year: number, month: number, day: number, hour: number, minute: number, second: number}{ year: new Date().getFullYear(), month: new Date().getMonth(), day: new Date().getDate(), hour: new Date().getHours(), minute: new Date().getMinutes(), second: new Date().getSeconds() }Object containing year, month, day, hour, minute, and second. month is zero-based.

Pass objects and arrays as JavaScript properties.

'start' | 'end'undefinedAssign the start or end role in range selection.
stringundefinedRange endpoint currently being edited: start or end.
{year: number, month: number, day: number }undefinedStart date of the selected range. month is zero-based.

Pass objects and arrays as JavaScript properties.

{year: number, month: number, day: number }undefinedEnd date of the selected range. month is zero-based.

Pass objects and arrays as JavaScript properties.

stringundefinedDate under the pointer during range selection.
string'Su,Mo,Tu,We,Th,Fr,Sa'Comma-separated weekday names, from Sunday through Saturday.
booleanfalseStart the week on Monday.
booleanfalseHide Saturdays and Sundays in the calendar.
Datenew Date()Reference date for the current calendar view, passed as a Date object.

Pass objects and arrays as JavaScript properties.

Events

EventDetailDescription
CustomEvent<unknown>Emitted when the value or selection state changes.
CustomEvent<unknown>Emitted when the user selects an item.
CustomEvent<unknown>Read the result from the event's detail.
CustomEvent<unknown>Read the result from the event's detail.

<sy-date-time-calendar>

Properties

Attribute / PropertyTypeDefaultDescription
'day' | 'month' | 'year' | 'decade''day'Day, month, year, or decade view.
{year: number, month: number, day: number, hour: number, minute: number, second: number}{ year: new Date().getFullYear(), month: new Date().getMonth(), day: new Date().getDate(), hour: new Date().getHours(), minute: new Date().getMinutes(), second: new Date().getSeconds() }Object containing year, month, day, hour, minute, and second. month is zero-based.

Pass objects and arrays as JavaScript properties.

string'Su,Mo,Tu,We,Th,Fr,Sa'Comma-separated weekday names, from Sunday through Saturday.
booleanfalseStart the week on Monday.
booleanfalseHide Saturdays and Sundays in the calendar.

Events

EventDetailDescription
CustomEvent<unknown>Emitted when the user selects an item.

<sy-range-calendar>

Properties

Attribute / PropertyTypeDefaultDescription
'day' | 'month' | 'year'undefinedDay, month, or year view.
stringundefinedEndpoint currently being edited: start or end.
{year: number, month: number, day: number, hour: number, minute: number, second: number}undefinedObject containing year, month, day, hour, minute, and second. month is zero-based.

Pass objects and arrays as JavaScript properties.

{ year: number, month: number, day: number }undefinedStart date of the selected range. month is zero-based.

Pass objects and arrays as JavaScript properties.

{ year: number, month: number, day: number }undefinedEnd date of the selected range. month is zero-based.

Pass objects and arrays as JavaScript properties.

string'Su,Mo,Tu,We,Th,Fr,Sa'Comma-separated weekday names, from Sunday through Saturday.
booleanfalseStart the week on Monday.
booleanfalseHide Saturdays and Sundays in the calendar.

Events

EventDetailDescription
CustomEvent<unknown>Emitted when the user selects an item.

<sy-timepicker>

Properties

Attribute / PropertyTypeDefaultDescription
number0Hour, from 0 to 23.
number0Minute, from 0 to 59.
number0Second, from 0 to 59.
booleanfalseHide the time selection panel's confirmation button.
string':'Separator character between time units.
string'hh:mm:ss'Format used to display and parse values. See the usage guide for tokens or format values.

Events

EventDetailDescription
CustomEvent<unknown>Emitted when the user selects an item.
CustomEvent<unknown>Emitted when the value or selection state changes.