Calendar Layout Component: Event types
Back to Calendar Layout Component.
Event types
Section titled “Event types”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.
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
identifier | string | yes | Unique 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. | |
module | string | yes | Identifier 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. | |
field | string | yes | Identifier 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. | |
color | string (CSS color) | no | FullCalendar default; #1890ff for the sidebar checkbox | Background color of the events and of the sidebar checkbox. |
text_color | string (CSS color) | no | FullCalendar default | Text color of the events. |
icon | string | no | Icon name shown at the right edge of the event. | |
title | string | no | empty | Static title for all events of this type. Normally you use recipes.title instead. |
quick_create | boolean | no | false | Allow creating an entity of this module by clicking an empty day. See Interactions. |
editable | boolean | no | the calendar’s editable (true) | Whether events of this type can be moved and resized. |
pre_filters | array<PreFilter> | no | Restricts which entities are loaded, see Filters and permissions. | |
recurrence | string or object | no | Repeat every event of this type, e.g. "yearly". See Recurring events. Usually set with a recipe. | |
recurrence_field | string | no | Identifier 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. | |
recipes | object<string, Recipe> | no | Recipes that compute event attributes per entity, see Event titles and recipes. |
Event titles and recipes
Section titled “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:
| Attribute | Type | Meaning |
|---|---|---|
title | string | Text shown on the event. |
color | string | Background color. |
text_color | string | Text color. |
icon | string | Icon name. |
html | string | HTML that replaces the whole content of the event. Make sure it contains no unescaped user input. |
start_time | string (HH:mm) | For date fields: start time of the event on that day. |
end_time | string (HH:mm) | For date fields: end time of the event on that day. |
full_day | boolean | Force the event to be an all-day event. |
display | string | FullCalendar display mode, default block. |
editable | boolean | Whether this single event can be moved or resized. |
recurrence | string or object | Repeat rule, see below. |
exdate | array<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.
Recurring events
Section titled “Recurring events”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.