Skip to content

Calendar - Web Component โ€‹

Browser support โ€‹

Detected engine: ย 

  • Chromium

  • Webkit

  • Gecko

Parameters โ€‹

The Web component uses the <z-calendar> tag:

The parametrization of the component can be done with the following custom HTML params:

NameTypeDescription
value
(optional)
stringThe selected date.
first-weekday
(optional)
stringThe first day of the week.
calendar-type
(optional)
stringThe calendar type.
locale
(optional)
stringThe localization attribute.

The events emitted from the component are:

NamePayloadDescription
onchangestringFires when the selected date changes.

value โ€‹

By defining the value prop, you can set the initial value of the input.

first-weekday โ€‹

By defining the first-weekday prop, you can set the first day of the week. Possible values are sunday and monday. If not defined, the default value is monday.

calendar-type โ€‹

By defining the calendar-type prop, you can set the type of the calendar.

locale โ€‹

Attention!

The localization format of the input comes from the format settings of the client's operation system.

By defining the locale prop, you can set the locale of the calendar. If not defined, the default will be the browser's locale.

The calendar component it's highly customizable. You can use the --z-calendar--header--bg, --z-calendar--header--color, --z-calendar--bg, --z-calendar--color and --z-calendar--radius to customize the background and color of the header, the background and color of the calendar, and the radius of the calendar.

Playground โ€‹

Customization โ€‹

HTML Examples โ€‹

Imports
html
<link rel="stylesheet" href="/0.4.5/@zurich/web-components/styles.css" />
<script type="module" src="/0.4.5/@zurich/web-components/calendar.js"></script>
Code
html
<z-calendar value="2024-04-26"></z-calendar>