Skip to main content

Calendar

The Calendar widget draws a month-view calendar, displays dates, and lets users select a date by tapping a cell.
Mark event dots on specific dates, switch between month and week views, and hook actions to date selection and month navigation.

Definition and role

The Calendar widget draws a grid of dates for one month plus a header with the year and month. When a user taps a date cell, that date becomes selected and the onDateSelected action runs. Every date in the list you specify shows an event dot, and you can color dates differently depending on whether they fall before or after today and whether they have an event. Two formats are supported: month view and week view.

  • Category: Contents
  • Default format: month view (month)
  • Default header: today header (todayHeader)

Features

FeatureDescription
Date selectionTapping a date cell selects that date and runs the onDateSelected action.
Event displayShows an event dot on every date in the eventDate list.
Format switchingSwitches between month view and week view. Show or hide the format switch bar.
Month navigationMove to the previous or next month from the header. When the page changes, the onPageChanged action runs.
Range limitsSet the first (firstDay) and last (lastDay) selectable date.
Colors and textAdjust colors per state — past/future, selected, and event — plus the text styles for the header, weekdays, and dates.

How to use

  1. Open the Contents category in the left widget palette.
  2. Drag and drop the Calendar item onto the canvas.
  3. In the properties panel on the right, set the basic display — format (calendarFormat), header (header), and so on.
  4. In onDateSelected, connect the action — logic or script — to run when a user selects a date.
  5. Adjust event dates, range limits, and per-state colors as needed.

Properties

note

The header, weekday, and date text style properties set only size and weight, not text color. Set colors with the color properties below.

PropertyDescriptionDefaultValue / Type
calendarFormatCalendar display formatmonthmonth, week
selectedDateDate selected initiallyNot setString (date)
firstDayFirst selectable dateNot setString (date)
lastDayLast selectable dateNot setString (date)
eventDateList of dates to mark with an event dotNot setList of strings
rowHeightHeight of a date rowNot set (runtime default 32)Number (px, 0 or greater)
headerHeader formtodayHeadertodayHeader, arrowHeader
headerNavModeHow date navigation opens when the header (year and month) is tappedpopuppopup, inline
headerVisibleWhether the header is visibletrueBoolean
dayOfWeekVisibleWhether the weekday row is visibletrueBoolean
typeChangeBarVisibleWhether the format switch bar is visibletrueBoolean
outsideDaysVisibleWhether dates outside the current month — the previous and next month — are visibletrueBoolean
headerColorHeader text and icon color (title, today, arrows)#FFFFFFColor
beforeNowDateColorText color for dates before today#FFFFFFColor
beforeNowSelectedDateColorText color for a selected date before today#121212Color
beforeNowSelectedBgColorBackground color for a selected date before today#FAFAFAColor
afterNowDateColorText color for dates after today#A0A0A0Color
afterNowSelectedDateColorText color for a selected date after today#A0A0A0Color
afterNowSelectedBgColorBackground color for a selected date after today#FAFAFAColor
beforeNowEventDateColorText color for an event date before today#FFCB00Color
beforeNowEventSelectedDateColorText color for a selected event date before today#121212Color
beforeNowEventSelectedBgColorBackground color for a selected event date before today#FFCB00Color
afterNowEventDateColorText color for an event date after today#84C13DColor
afterNowEventSelectedDateColorText color for a selected event date after today#FFFFFFColor
afterNowEventSelectedBgColorBackground color for a selected event date after today#84C13DColor
dayOfWeekTextColorWeekday text color#616161Color
dragBarColorColor of the format switch (drag) bar#FFFFFFColor
disabledColorColor of disabled (unselectable) dates#4D4D4DColor
headerTitleTextStyleHeader title text style (color excluded)13px, weight 600Text style
headerActionTextStyleHeader action text style (color excluded)13px, weight 500Text style
monthPickerTextStyleMonth picker text style (color excluded)13pxText style
dayOfWeekTextStyleWeekday text style (color excluded)14pxText style
dayTextStyleDate text style (color excluded)14pxText style

Notes and tips

tip

The color of a date cell comes from a combination of three things: whether the date is past (beforeNow*) or future (afterNow*) relative to today, whether it has an event, and whether it is selected. Set a color for each state.

note

Text style properties such as headerTitleTextStyle and dayTextStyle exclude text color. Set text color with the separate color properties — beforeNowDateColor, dayOfWeekTextColor, and so on.

Learn more

tip

For the full set of Widget Control (Property, Method, and Event) you can use to script this widget, see Calendar Widget Control.