Skip to content

Calendar Layout Component: Event types

Back to Calendar Layout Component.

Every entry in options.events is one event type. The calendar loads the entities of module that fall into the visible date range and draws one event per entity.

OptionTypeRequiredDefaultDescription
identifierstringyesUnique name of the event type within this calendar. Used as key for the sidebar selection and as translation key calendar.<identifier> for the label in the sidebar.
modulestringyesIdentifier of the module whose entities become events. If the module or the field does not exist in the frontend (for example because the user may not see the module), the event type is silently skipped.
fieldstringyesIdentifier of the date field of that module. Supported field types: date, datetime, dateRange. For dateRange the start and end of the range are the start and end of the event.
colorstring (CSS color)noFullCalendar default; #1890ff for the sidebar checkboxBackground color of the events and of the sidebar checkbox.
text_colorstring (CSS color)noFullCalendar defaultText color of the events.
iconstringnoIcon name shown at the right edge of the event.
titlestringnoemptyStatic title for all events of this type. Normally you use recipes.title instead.
quick_createbooleannofalseAllow creating an entity of this module by clicking an empty day. See Interactions.
editablebooleannothe calendar’s editable (true)Whether events of this type can be moved and resized.
pre_filtersarray<PreFilter>noRestricts which entities are loaded, see Filters and permissions.
recurrencestring or objectnoRepeat every event of this type, e.g. "yearly". See Recurring events. Usually set with a recipe.
recurrence_fieldstringnoIdentifier of a field of the module that holds the repeat frequency. Needed so that repeating entities are found regardless of the visible range, see Recurring events.
recipesobject<string, Recipe>noRecipes that compute event attributes per entity, see Event titles and recipes.

recipes maps an event attribute to a recipe. Each recipe is evaluated once per entity. Inside the recipe, this is the entity (all fields of the module are available, relations as far as they are loaded in the module’s table response). The entity of the surrounding layout, if there is one, is available as this._context.

The result of the recipes overrides the static value of the same name in the event type. These attributes are read by the calendar:

AttributeTypeMeaning
titlestringText shown on the event.
colorstringBackground color.
text_colorstringText color.
iconstringIcon name.
htmlstringHTML that replaces the whole content of the event. Make sure it contains no unescaped user input.
start_timestring (HH:mm)For date fields: start time of the event on that day.
end_timestring (HH:mm)For date fields: end time of the event on that day.
full_daybooleanForce the event to be an all-day event.
displaystringFullCalendar display mode, default block.
editablebooleanWhether this single event can be moved or resized.
recurrencestring or objectRepeat rule, see below.
exdatearray<string>Dates on which a recurring event is skipped.

Example: show the name of the employee next to a fixed text and color holidays by status:

{
"identifier": "holidays",
"module": "holidays",
"field": "period",
"recipes": {
"title": "'Holiday: ' + this.employee.name",
"color": "this.approved ? '#52c41a' : '#faad14'"
}
}

Event types without a title recipe or title option show events without text, so set one.

Set recurrence to a frequency string ("daily", "weekly", "monthly", "yearly") to repeat an event forever, starting at the date of the entity. For more control pass an rrule object, for example {"freq": "weekly", "interval": 2, "byweekday": ["MO", "WE"], "until": "2027-12-31"}; dtstart is set from the entity automatically. exdate lists dates to skip.

Usually every entity brings its own frequency, stored in a field. Combine both options:

{
"identifier": "recurring_tasks",
"module": "tasks",
"field": "due",
"recurrence_field": "repeat",
"recipes": {
"title": "this.name",
"recurrence": "this.repeat"
}
}

recurrence_field is required for this to work correctly. A repeating entity may start long before the visible range, so the calendar must load it regardless of its date. It does so by also loading every entity whose recurrence_field has one of the values daily, weekly, monthly, quarterly or yearly and whose date is not after the visible range. Entities without a value in recurrence_field are loaded only when their own date is in the range. Without recurrence_field, a repeating entity is loaded only when its first date lies in the loaded range, so later repetitions do not appear once you navigate away from it.