Vivid API

Calendar

The Calendar component displays events in a visual date grid in a week views, allowing users to view and interact with the displayed events.

Setting the Displayed Week

By default, the Calendar displays the week based on today’s date.

Use the datetime attribute to control which week is shown. This attribute accepts any value supported by the JavaScript Date() constructor. In the example below, YYYY-MM-DD formatted strings are used.

The week displayed is the week that includes the provided date.

Sticky Mode

The sticky-mode attribute controls which parts of the Calendar remain fixed when scrolling:

  • all → keeps both time column and day header sticky (default)
  • header → keeps the day headers sticky
  • column → keeps the time column sticky
  • none → nothing is sticky

Sticky behavior requires the Calendar (or it’s container) to have a defined width and height. Without these, scrolling won’t occur and elements won’t stick.

Modifying the Week View’s Start Day

By default, the week view will start on Monday. Using the start-day attribute this can be changed to Sunday as in the example below.

Displaying Times in 12 Hour Format

By default times are displayed using a 24 hour format. This can be changed to a 12 hour format using the hour12 attribute.

Locales

The locales attribute lets you specify a locale string or an array of locale strings to control the language and regional formatting of the Calendar.

  • If multiple locales are provided, list them in descending order of priority, with the first being the preferred locale.
  • If omitted, the Calendar defaults to the JavaScript runtime’s locale.
  • Locale strings must conform to BCP 47 standards. Eg. en-US or en-US, he-IL.