Eventcalendar API
Here is a comprehensive list of all the options, events and method the Eventcalendar has.
Options
Explore the following API options that help you easily configure the Eventcalendar.
actionableEvents
boolean
Specifies if the events on the agenda and inside the calendar popover are actionable or not.
If actionable, the event items will have hover and active states, and pointer cursor.
Set to false when custom event rendering is used and the event list items contain other actionable elements, e.g. buttons.
Default value: true
clickToCreate
boolean | "double" | "single"
Enable new event creation on click. If true or 'double', a new event will be created only with a double click
and with the 'single' value the event will be created instantly with a single click.
This option will only work on desktop environment where mouse events are fired. It will also allow deleting of the focused events using the Delete or Backspace key.
In touch environment a long tap should be used to create a new event and it is controlled by the dragToCreate option.
Using the extendDefaultEvent option extra properties can be set for the created event.
The event deletion functionality can be overwritten using the eventDelete option.
Default value: undefined
colors
Array<MbscCalendarColor>
Specifies the color for certain dates or date ranges on the calendar.
The MbscCalendarColor type has the following properties:
allDay: boolean - Specifies whether the date you want to color is all day or not.background: string - Background color of the cell. It can be any valid CSS color ('red','#ff0000','rgb(255, 0, 0)', etc.).cellCssClass: string - CSS class for the day cell. Only applicable for the calendar view.cssClass: string - Specifies a custom CSS class for the color. Useful when customization is needed for the background of cells and time ranges. Only applicable for the timeline and scheduler views.date: string | object | Date - Specifies a single date for the colorend: string | object | Date - Specifies the end date/time of a date/time range for the colorhighlight: string - Highlight color of the day, can be any valid CSS color ('red','#ff0000','rgb(255, 0, 0)', etc.).recurring: string | MbscRecurrenceRule - Specifies a recurrence rule for handling recurring days.recurringException: string | object | Date | Array<string | object | Date> - Exception dates of the recurring rule. Useful when specific dates need to be skipped from the rule.recurringExceptionRule: string | MbscRecurrenceRule - Exception rule of the recurring rule. Useful when recurring dates need to be skipped from the rule.resource: string | number | Array<string | number> - In case of the timeline and scheduler view of the Eventcalendar, specifies the resource ids for the color. The color will be displayed only on the specified resource. If there is no resource defined, it will be applied to every resource.slot: string | number - In case of the timeline view of the Eventcalendar, specifies the slot id for the color. The color will be displayed only on the specified slot. If there is no slot defined, it will be applied to every slot.start: string | object | Date - Specifies the start date/time of a date/time range for the colortextColor: string - A color applied on the text.title: string - A title that will be displayed on the item.
The colored range will be considered all-day if:
- the
allDayproperty is explicitly set. - the
start/endproperties are not specified, only thedate.
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
[
{ date: new Date(2020, 2, 23), background: 'pink' },
{ date: new Date(2020, 2, 24), background: 'green' },
{ background: '#ff0000', recurring: { repeat: 'weekly', weekDays: 'SU' } },
{ background: 'yellow', recurring: { repeat: 'weekly', weekDays: 'SA' } }
]
Default value: undefined
connections
Array<MbscEventConnection>
Specifies connections between events. On the UI events will be linked with lines and additionally arrows can be displayed to illustrate the direction of the connection. Events can have multiple connections simultaneously.
An array of connection objects can be passed.
The MbscEventConnection type has the following properties:
arrow: boolean | "from" | "to" | "bidirectional" - Specifies where to display arrows Iftrue, the arrow will display only at the end side of the connection.color: string - Specifies the color of the connection.cssClass: string - Custom CSS class for the connection line for further customization.from: string | number - The id of the event where the connection will beginto: string | number - The id of the event where the connection will end.type: "fs" | "sf" | "ss" | "ff" - The type of the connection. Possible values:'fs'- finish-to-start,'sf'- start-to-finish,'ss'- start-to-start,'ff'- finish-to-finish.
Default value: undefined
context
string | HTMLElement
The DOM element in which the popups (event popover, year and month picker) are rendered. Can be a selector string or a DOM element.
Default value: 'body'
cssClass
string
Specifies a custom CSS class for the component.
Default value: undefined
data
Array<MbscCalendarEvent>
The events for the Eventcalendar.
The MbscCalendarEvent type has the following properties:
allDay: boolean - Specifies if the event is all day or not.bufferAfter: number - Defines a buffer time in minutes that will be displayed after the end of the event.bufferBefore: number - Defines a buffer time in minutes that will be displayed before the start of the event.cellCssClass: string - CSS class for the day cell. Only applicable for the calendar view.color: string - Background color of the eventcssClass: string - Specifies a custom CSS class that is applied to the event. Useful when customization is needed on the event level. For example: setting the width for specific events.date: string | object | Date - Specifies a single date for the eventdragBetweenResources: boolean - Specifies whether the event is movable across resources.dragBetweenSlots: boolean - Specifies whether the event is movable across across slots.dragInTime: boolean - Specifies whether the event is movable in time.editable: boolean - Specifies if an event is editable or not. If false, drag & drop and resize is not allowed.end: string | object | Date - Specifies the end date/time of a date/time range for the eventid: string | number - A unique id for the event. If not specified, the event will get a generated id.order: number - Specifies the order of the event in the array. Has precedence over the default ordering rules.overlap: boolean - Specifies whether the event can be overlapped. Has precedence over theeventOverlapproperty of the resource and the eventOverlap option.recurring: string | MbscRecurrenceRule - Specifies a recurrence rule for handling recurring events.recurringException: string | object | Date | Array<string | object | Date> - Exception dates of the recurring rule. Useful when specific dates need to be skipped from the rule.recurringExceptionRule: string | MbscRecurrenceRule - Exception rule of the recurring rule. Useful when recurring dates need to be skipped from the rule.resize: boolean - Specifies whether the event is resizable. Has precedence over theeventResizeproperty of the resource and the dragToResize option.resource: string | number | Array<string | number> - In case of the timeline and scheduler view of the Eventcalendar, specifies the resource ids for the event. The event will be displayed only on the specified resource. If there is no resource defined, it will be displayed on every resource.slot: string | number - In case of the timeline view of the Eventcalendar, specifies the slot id for the event. The event will be displayed only on the specified slot. If there is no slot defined, it will be displayed on every slot.start: string | object | Date - Specifies the start date/time of a date/time range for the eventtextColor: string - A color applied on the text.timezone: string - Timezone of the eventtitle: string - The title of the event.tooltip: string - The tooltip text of the event.
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
The event objects may have additional custom properties as well. The custom properties are not used by the event calendar, but they are kept and will be available anywhere the event objects are used. E.g. the onEventClick event will receive the event object as argument, containing the custom properties as well.
Use the getEvents method to get the events between two dates.
data: [
{
start: new Date(2021, 5, 23),
end: new Date(2021, 5, 30),
title: 'Conference',
allDay: true,
color: 'red'
},
{
title: 'Work project',
recurring: {
repeat: 'daily',
until: '2021-04-01'
},
recurringException: ['2021-03-15', '2021-03-25'],
recurringExceptionRule: {
repeat: 'weekly',
weekDays: 'SA,SU'
}
}
]
Default value: undefined
dataTimezone
string
The timezone in which the data is interpreted. If the data contains timezone information
(when the ISO string has a timezone offset, e.g. "2021-03-28T01:00:00Z" or "2021-03-28T03:00:00+03:00")
then the data's timezone is used instead.
When using timezones, the exclusiveEndDates option is also turned on by default.
When using anything other than the default ('local'), a timezone plugin
must be also passed to the component.
Possible values:
'local'- The system's local timezone.'utc'- UTC (Universal Coordinated Time) timezone.- Timezone name - The timezone name from the
IANA time zone database, e.g.
"America/New_York".
If not specified, it defaults to the displayTimezone.
Default value: undefined
defaultSelectedDate
Specifies the initial selected date on the calendar.
For views, where time is also displayed, the view will be scrolled to the specified time. If the time part is not explicitly specified, it defaults to the start of the day.
Default value: undefined
displayTimezone
string
The timezone in which the data is displayed.
When using timezones, the exclusiveEndDates option is also turned on by default.
When using anything other than the default ('local'), a timezone plugin
must be also passed to the component.
Possible values:
'local'- The system's local timezone.'utc'- UTC (Universal Coordinated Time) timezone.- Timezone name - The timezone name from the
IANA time zone database, e.g.
"America/New_York".
Default value: 'local'
dragBetweenResources
boolean
If false, the events will not be moveable across resources, only in time.
To control movement in time, use the dragInTime option.
Consider that dragToMove has to be enabled.
Default value: true
dragBetweenSlots
boolean
If false, the events will not be moveable across slots, only in time and resource.
To control movement in time, use the dragInTime option.
Consider that dragToMove has to be enabled.
Default value: true
dragInTime
boolean
If false, the events will not be moveable in time.
In case of the scheduler and timeline views events events can still be moved between resources.
To control movement between resources, use the dragBetweenResources option.
Consider that dragToMove has to be enabled.
Default value: true
dragTimeStep
number
Specifies the steps in minutes for the scheduler and timeline events during drag.
Default value: 15
dragToCreate
boolean
If true, dragging on an empty cell will create a new event.
It will also allow deleting of the focused events using the Delete or Backspace key.
The title of the new event can be specified with the newEventText option.
Using the extendDefaultEvent option extra properties can be set for the created event.
The event deletion functionality can be overwritten using the eventDelete option.
Default value: undefined
dragToMove
boolean
If true, the events will be moveable.
Default value: undefined
dragToResize
boolean
If true, the events will be resizable.
Default value: undefined
eventDelete
boolean
Enables or disables event deletion. When true, the focused event will be deleted on pressing the Delete or Backspace
keys on the keyboard.
By default the event deletion depends on the clickToCreate and dragToCreate options.
If either of those are true, and no eventDelete option is set, then event deletion is also enabled, otherwise not.
Default value: undefined
eventOrder
(event1: MbscCalendarEvent, event2: MbscCalendarEvent) => number
Determines the ordering of the events within the same day. Can be a function that accepts two event objects as arguments and should return -1 or 1.
If not specified, the default order is:
- all day events
- rest of events, sorted by start time; events with identical start times, will be ordered alphabetically based on their title
Default value: undefined
eventOverlap
boolean
If false, the events cannot overlap.
Default value: true
exclusiveEndDates
boolean
If true, the Eventcalendar will work in exclusive end dates mode,
meaning that the last moment of the range (event, invalid, colors, etc.) is not part of the range.
E.g. end: '2021-07-03T00:00' means that the event ends on 2nd of July and will not be displayed on 3rd of July.
When using timezones, the exclusiveEndDates option will default to true.
extendDefaultEvent
(args: MbscNewEventData) => void | MbscCalendarEvent
Use this option to set properties to the new event created with click or drag. The event creation is handled by the clickToCreate and dragToCreate options. It takes a function that should return the properties for the new event. The argument object passed to this function has the following properties:
start: Date - The date when the newly created event will start.resource: string | number - The id of the resource where the event creation started.
extendDefaultEvent: (args) => {
return {
color: args.resource === 'admin' ? 'green' : 'red',
title: 'My event',
};
}
Default value: undefined
externalDrag
boolean
If true, external drag & drop is allowed and events can be dragged outside of the component view.
Default value: undefined
externalDrop
boolean
If true, external events can be dragged into the view.
Default value: undefined
externalResourceDrag
boolean
If true, external drag & drop is allowed and resource can be dragged outside of the component view.
Default value: undefined
externalResourceDrop
boolean
If true, external resources can be dragged into the view.
Default value: undefined
groupBy
"date" | "resource"
Groups the events by date or by resource.
Default value: 'resource'
height
string | number
Sets the height of the component.
The height of the calendar view impacts the number of labels that fit into a table cell. A "show more" label will be displayed for events that don't fit.
Default value: undefined
immutableData
boolean
If true, the Eventcalendar will work in immutable mode.
In this mode the component won't update the data directly,
only fire the necessary lifecycle events, where the original data can be updated manually.
Default value: undefined
invalid
Array<MbscDateType> | Array<MbscCalendarInvalid>
An array containing the invalid values. Can contain dates, or objects with the following properties:
allDay: boolean - Specifies whether the invalid range is all day or not.start: Date | string | object - Start of the invalid range.end: Date, string | object - End of the invalid range.recurring: string | object - Recurrence rule for recurring invalid ranges.recurringException: string | object | Array<string | object> - Exception dates of the recurring rule. Useful when specific dates need to be skipped from the rule.recurringExceptionRule: string | object - Exception rule of the recurring rule. Useful when recurring dates need to be skipped from the rule.resource: string | number | Array<string | number> - Specifies the resource ids for the invalid range. The invalid range will be displayed only in the specified resource. If there is no resource defined, the invalid range will be displayed in every resource.slot: string | number - Specifies the slot id for the invalid range. The invalid range will be displayed only in the specified slot. If there is no slot defined, the invalid range will be displayed in every slot.title: string - Text which will be displayed for the invalid range. Only applicable for the timeline and scheduler views.
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
[
// Passing exact dates and times
new Date(2021, 1, 7), // Date object
'2021-10-15T12:00', // ISO 8601 string
moment('2020-12-25'), // moment object
// Passing invalid ranges
{
// ISO 8601 strings
start: '2021-10-15T12:00',
end: '2021-10-18T13:00',
title: 'Company 10th anniversary',
},
{
// Date objects
allDay: true,
start: new Date(2021, 2, 7),
end: new Date(2021, 2, 9),
title: 'Conference for the whole team',
},
{
// Time range with recurrence
start: '13:00',
end: '12:00',
recurring: { repeat: 'weekly', weekDays: 'MO,TU,WE,TH,FR' },
title: 'Lunch break',
},
{
// Disable weekends
recurring: {
repeat: 'weekly',
weekDays: 'SA,SU'
}
}
]
Default value: undefined
The MbscCalendarInvalid type has the following properties:
allDay: boolean - If true the specified invalid will cover the whole day.end: MbscDateType - Specifies the end of the invalid range.recurring: string | MbscRecurrenceRule - Recurrence rule for recurring invalid ranges.recurringException: MbscDateType | Array<MbscDateType> - Specifies recurring exceptions. Useful when specific dates need to be skipped from the rule.recurringExceptionRule: string | MbscRecurrenceRule - Specifies a recurrence exception rule. Useful when recurring dates need to be skipped from the rule.start: MbscDateType - Specifies the start of the invalid range.
invalidateEvent
"start-end" | "strict"
Specifies how to validate events against invalid ranges on create/move/resize:
'strict'- The event cannot intersect with an invalid range at all.- `'start-end' - The event start and end cannot be inside an invalid range.
Default value: 'strict'
labels
Array<MbscCalendarLabel>
Specifies labels for calendar days.
The MbscCalendarLabel type has the following properties:
cellCssClass: string - CSS class for the day cell. Only applicable for the calendar view.color: string - Background color of the label.cssClass: string - Specifies a custom CSS class that is applied to the label.date: string | object | Date - Specifies a single date for the labelend: string | object | Date - Specifies the end date/time of a date/time range for the labelorder: number - Specifies the order of the label in the array. Has precedence over the default ordering rules.recurring: string | MbscRecurrenceRule - Specifies a recurrence rule for handling recurring days.recurringException: string | object | Date | Array<string | object | Date> - Exception dates of the recurring rule. Useful when specific dates need to be skipped from the rule.recurringExceptionRule: string | MbscRecurrenceRule - Exception rule of the recurring rule. Useful when recurring dates need to be skipped from the rule.start: string | object | Date - Specifies the start date/time of a date/time range for the labeltextColor: string - A color applied on the text.title: string - The title of the label.tooltip: string - Tooltip for the label
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
The labels can be combined with the colors option.
[
{
start: new Date(2020, 2, 23),
end: new Date(2020, 2, 24),
text: 'Conference',
color: 'red'
},
{
text: 'Christmas',
recurring: { repeat: 'yearly', month: 12, day: 24 }
}
]
Default value: undefined
marked
Array<MbscCalendarMarked>
Mark certain dates on the calendar. An array containing dates, or objects with the following properties:
The MbscCalendarMarked type has the following properties:
cellCssClass: string - CSS class for the day cell. Only applicable for the calendar view.color: string - Color of the mark.date: string | object | Date - Specifies a single date when this is applicableend: string | object | Date - Specifies the end date/time of a date/time range when this is applicablemarkCssClass: string - CSS class for the mark.recurring: string | MbscRecurrenceRule - Specifies a recurrence rule for handling recurring days.recurringException: string | object | Date | Array<string | object | Date> - Exception dates of the recurring rule. Useful when specific dates need to be skipped from the rule.recurringExceptionRule: string | MbscRecurrenceRule - Exception rule of the recurring rule. Useful when recurring dates need to be skipped from the rule.start: string | object | Date - Specifies the start date/time of a date/time range when this is applicabletextColor: string - A color applied on the text.title: string - A title that will be displayed on the item.
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
The marked days can be combined with the colors option.
[
new Date(2020, 2, 15),
new Date(2020, 2, 22),
{
start: new Date(2020, 2, 23),
end: new Date(2020, 2, 24),
color: 'red'
},
{
color: 'green',
recurring: { repeat: 'yearly', month: 12, day: 24 }
}
]
Default value: undefined
max
Maximum date and time. The calendar cannot be navigated beyond the specified maximum date. If navigation is needed, but event creation should not be allowed after a specific date, use the invalid option with daily recurrence starting from the specific date.
Default value: undefined
min
Minimum date and time. The calendar cannot be navigated beyond the specified minimum date. If navigation is needed, but event creation should not be allowed before a specific date, use the invalid option with daily recurrence until the specific date.
Default value: undefined
modules
Array<IModule>
Additional modules can be added to the eventcalendar. The option receives an array of module objects. For example, the print module can be added through this option.
// import the print module
import { print } from '@mobiscroll/print';
// later on, add it to the modules array:
modules: [print]
refDate
Specifies the reference date for the view calculation, when multiple days, weeks, months or years are displayed. If not specified, for the scheduler and timeline views will be today's date, for the calendar and agenda views will be 1970/01/01.
It denotes the reference point when calculating the pages going in the future and in the past.
For example if the view type is day, the view size is 3, and the current date is 01/16/2024,
the pages are calculated from this date, so the initial page will contain [01/16/2024, 01/16/2024, 01/17/2024],
the next page [01/18/2024, 01/19/2024, 01/20/2024] and so on.
In case of day view, the reference point will be exactly the specified date. For week, month and year views the reference point will be the start of the week, month or year of the specified day.
Changing the reference date will not navigate the calendar to the specified date, it only recalculates the pages from the new reference date. To navigate the view to a specified date and time, use the selectedDate option.
Default value: undefined
resources
null | Array<MbscResource>
The scheduler and timeline views can handle multiple resources. Resource grouping can be modified with the help of the groupBy option.
If set to null or undefined, all events will be displayed, regardless of their resource property.
The timeline view will not display the resource column, if the resources option is not set.
If set to an empty array, only those events will be displayed which are not tied to any resource. The timeline view will display an empty resource column when an empty array is passed.
The timeline view can render multiple levels of hierarchy groups. Levels can be added with the help of the children property.
The MbscResource type has the following properties:
background: string - Specifies the background color of the resource row or column.children: Array<MbscResource> - Child resources.collapsed: boolean - Specifies the displayed state of the child resource group.color: string - Specifies the default event color of the resource. If an event has an explicit color set, the resource color will be overridden. If the color is not set, the events of the resource will inherit the default calendar color.cssClass: string - Specifies a css class for the resource row or column.eventCreation: boolean - Disables event creation on specific resources by setting it to false. Defaults to true.eventDragBetweenResources: boolean - Specifies whether the events in this resource are movable across resources. It applies for scheduler and timeline views. Has precedence over the dragBetweenResources option.eventDragBetweenSlots: boolean - Specifies whether the events in this slot are movable across slots. Has precedence over the dragBetweenSlots option.eventDragInTime: boolean - Specifies whether the events in this resource are movable in time. Has precedence over the dragInTime option.eventOverlap: boolean - Specifies whether the events in this resource can be overlapped. Has precedence over the eventOverlap option.eventResize: boolean - Specifies whether the events in this resource are resizable. Has precedence over the dragToResize option.fixed: boolean - Specifies whether the resource is fixed to the top. It applies for timeline view ifresolutionVerticalin view option is not given, or it's value is set tonone. Consider that the fixed resources always have to be the first elements of the array in a sequence (no non-fixed resources inserted in between) so that the dra & rop and event creation functionalities to work properly.id: string | number - The id of the resource.name: string - Specifies the name of the resource.reorder: boolean - Specifies whether the resource can be dragged and reordered. It applies for timeline view ifresourceReorderin view option is enabled.
resources: [
{
id: 1,
name: 'Flatiron Room',
color: '#f7c4b4'
},
{
id: 2,
name: 'The Capital City',
color: '#c6f1c9'
},
{
id: 3,
name: 'Heroes Square',
color: '#e8d0ef'
}
]
Default value: undefined
responsive
MbscResponsiveOptions<MbscEventcalendarOptions>
Specifies different options for different container widths, in a form of an object, where the keys are the name of the breakpoints, and the values are objects containing the options for the given breakpoint.
The available width is queried from the container element of the component and not the browsers viewport like in css media queries
There are five predefined breakpoints:
xsmall- min-width: 0pxsmall- min-width: 576pxmedium- min-width: 768pxlarge- min-width: 992pxxlarge- min-width: 1200px
Custom breakpoints can be defined by passing an object containing the breakpoint property specifying the min-width in pixels.
Example:
responsive: {
small: {
display: 'bottom'
},
custom: { // Custom breakpoint, you can use multiple, but each must have a unique name
breakpoint: 600,
display: 'center'
},
large: {
display: 'anchored'
}
}
Default value: undefined
selectMultipleEvents
boolean
When true, enables multiple event selection on the calendar.
Default value: false
selectedDate
Specifies the selected date on the calendar. This can be changed programmatically and when changed the calendar will automatically navigate to the specified date.
For views, where time is also displayed, the view will be scrolled to the specified time. If the time part is not explicitly specified, it defaults to the start of the day.
This does not change the reference date that defines the reference point of the navigation pages. To change the reference point for the navigation (e.g. start the paging from the newly selected date) use the refDate option.
You also need to pass a handler for the onSelectedDateChange event to update the selected date when the date is changed from the calendar.
Default value: undefined
selectedEvents
Array<MbscCalendarEvent>
Specifies the selected events on the calendar. The onSelectedEventsChange event will be fired when the selected events change from the calendar.
The MbscCalendarEvent type has the following properties:
allDay: boolean - Specifies if the event is all day or not.bufferAfter: number - Defines a buffer time in minutes that will be displayed after the end of the event.bufferBefore: number - Defines a buffer time in minutes that will be displayed before the start of the event.cellCssClass: string - CSS class for the day cell. Only applicable for the calendar view.color: string - Background color of the eventcssClass: string - Specifies a custom CSS class that is applied to the event. Useful when customization is needed on the event level. For example: setting the width for specific events.date: string | object | Date - Specifies a single date for the eventdragBetweenResources: boolean - Specifies whether the event is movable across resources.dragBetweenSlots: boolean - Specifies whether the event is movable across across slots.dragInTime: boolean - Specifies whether the event is movable in time.editable: boolean - Specifies if an event is editable or not. If false, drag & drop and resize is not allowed.end: string | object | Date - Specifies the end date/time of a date/time range for the eventid: string | number - A unique id for the event. If not specified, the event will get a generated id.order: number - Specifies the order of the event in the array. Has precedence over the default ordering rules.overlap: boolean - Specifies whether the event can be overlapped. Has precedence over theeventOverlapproperty of the resource and the eventOverlap option.recurring: string | MbscRecurrenceRule - Specifies a recurrence rule for handling recurring events.recurringException: string | object | Date | Array<string | object | Date> - Exception dates of the recurring rule. Useful when specific dates need to be skipped from the rule.recurringExceptionRule: string | MbscRecurrenceRule - Exception rule of the recurring rule. Useful when recurring dates need to be skipped from the rule.resize: boolean - Specifies whether the event is resizable. Has precedence over theeventResizeproperty of the resource and the dragToResize option.resource: string | number | Array<string | number> - In case of the timeline and scheduler view of the Eventcalendar, specifies the resource ids for the event. The event will be displayed only on the specified resource. If there is no resource defined, it will be displayed on every resource.slot: string | number - In case of the timeline view of the Eventcalendar, specifies the slot id for the event. The event will be displayed only on the specified slot. If there is no slot defined, it will be displayed on every slot.start: string | object | Date - Specifies the start date/time of a date/time range for the eventtextColor: string - A color applied on the text.timezone: string - Timezone of the eventtitle: string - The title of the event.tooltip: string - The tooltip text of the event.
Default value: undefined
separator
string
Separator between date and time in the formatted date string.
Default value: ' '
showControls
boolean
Show or hide the calendar header controls: the previous and next buttons, and the current view button together with the year and month picker.
Default value: true
showEventBuffer
boolean
If true, it will display the event buffers defined in the event data.
Default value: true
showEventTooltip
boolean
If false, it will hide the native tooltip that shows up when hovering over an event.
Default value: true
slots
null | Array<MbscSlot>
The slots, besides the resources introduce a horizontal level of data grouping to the timeline view.
If set to null or undefined, all events will be displayed, regardless of their slot property.
If set to an empty array, only those events will be displayed which are not tied to any slot.
The MbscSlot type has the following properties:
eventDragBetweenSlots: boolean - Specifies whether the event is movable across slots.id: string | number - The id of the slot. It that can be referenced in the events/invalids/colors data.name: string - The name of the slot that will be displayed at the top of the slot column.
slots: [
{
id: 1,
name: 'Morning shift',
},
{
id: 2,
name: 'Afternoon shift',
}
]
Default value: undefined
theme
string
Specifies the visual appearance of the component.
If it is 'auto' or undefined, the theme will automatically be chosen based on the platform.
If custom themes are also present, they will take precedence over the built in themes, e.g. if there's an iOS based custom theme,
it will be chosen on the iOS platform instead of the default iOS theme.
Supplied themes:
'ios'- iOS theme'material'- Material theme'windows'- Windows theme
It's possible to modify theme colors or create custom themes.
Make sure that the theme you set is included in the downloaded package.
Default value: undefined
themeVariant
"light" | "dark" | "auto"
Controls which variant of the theme will be used (light or dark).
Possible values:
'light'- Use the light variant of the theme.'dark'- Use the dark variant of the theme.'auto'orundefined- Detect the preferred system theme on devices where this is supported.
To use the option with custom themes, make sure to create two custom themes, where the dark version has the same name as the light one,
suffixed with '-dark', e.g.: 'my-theme' and 'my-theme-dark'.
Default value: undefined
timezonePlugin
Specifies the timezone plugin, which can handle the timezone conversions.
By default the component uses the local timezone of the browser to interpret dates. If you want to interpret dates a different timezone, you will need an external library to handle the timezone conversions. There are two supported libraries: moment-timezone and luxon.
You can specify either the dataTimezone or the displayTimezone or both.
Depending on which external library you use you can pass either the momentTimezone, dayjsTimezone or luxonTimezone
objects. These objects can be imported from the mobiscroll bundle.
Default value: undefined
The MbscTimezonePlugin type has the following properties:
createDate: (s: any, year: string | number | Date | MbscTimezonedDate, month: number, date: number, h: number, min: number, sec: number, ms: number) => MbscTimezonedDate -parse: (date: string | number, s: any) => MbscTimezonedDate -
view
Configures the Eventcalendar view. Possible views:
calendar: Configures the calendar view. Properties:
type: 'week' | 'month' | 'year' (default'month') - Sets the calendar type.size: number (default1) - Specifies the number of displayed weeks or months.count: boolean (defaultfalse) - Iftrue, it will display the number of events on the days with events.eventDisplay: 'fill' | 'exact' (default 'fill') - Specifies how events are displayed.- If set to
'exact', events are displayed according to their start and end times. - If set to
'fill', events cover the entire day.
- If set to
outerDays: boolean (defaultfalse) - Show or hide days from previous and next months. Does not apply to week view.labels: boolean | number | 'all' (defaulttrue) - Enable displaying events as labels on calendar days.- If set to
true, events will be displayed in the available space. If there are more events for a day, than the available space, a label with "more" text will be displayed, which opens a popover showing all the events for the given day. To fit more events on a day, set the calendar height to an appropriate value, using the height option. - If set to
'all', all the events will be displayed in the calendar cell and the row height will auto-expand based on the displayed events. The view will became scrollable if the rows overflow the available height. - Specify a number to set how many events will be displayed before the "more" button in a calendar cell. The row height will auto expand until the labels count reaches the given number and after that the "x more" button will be displayed. In the case when only one event should go in the "more" popup, that event will be displayed in the place of the "x more" button.
- If set to
popover: boolean (defaultundefined) - Enable popover on days containing events. If not explicitly defined, the popover will not show up if an agenda view is also displayed. If event labels are displayed, the popover will only show up for days where the labels do not fit on the calendar, and a "more" label is present.popoverClass: string (defaultundefined) - A custom CSS class added to the popover element. Can be used to customize the styling of the popover.scroll: 'horizontal' | 'vertical' (default'horizontal') - Specifies the direction of the calendar scroll.weekNumbers: boolean (defaultfalse) - Show or hide week numbers.
agenda: Configures the agenda view. Properties:
-
type: 'day' | 'week' | 'month' | 'year' (default'month') - Sets the agenda type. If calendar is also displayed, only'month','week'and'day'values are supported. In case of month and week, the type and size should match the calendar type and size. In case of day type events on the selected calendar day will be displayed, so size will always be1. -
size: number (default1) - Specifies the number of displayed years, months, weeks or days. -
scrollable: boolean (defaulttrue) - Setting this totruemakes the agenda independently scrollable.infoThere are two prerequisites for making this work:
1 - The calendar needs to be to placed inside a container which has a height. This can be either a fixed height, a height in percentage, or a flex height. When the calendar is placed directly in a container with a fixed height, it will work out of the box. If the height of the container is specified in percentage, e.g. you'd like to fill the full page height, you need to make sure that all parent elements also have
'height: 100%'specified, up until thebodyandhtmlelements, or until the closest parent which has a fixed height. If the container is inside a parent with flex layout, it will also work out of the box.2 - The agenda needs a minimum height of 200px - the result of the container height minus the height of the calendar header minus the height of the displayed calendar rows. If the calculated height is less then 200px, the agenda will not be scrollable.
-
showEmptyDays: boolean (defaultfalse) - When set totrue, it will display day headers for every day in the list, even for those without events.
schedule: Configures the scheduler view. Properties:
-
type: 'day' | 'week' | 'month' (default'week') - Sets the scheduler type. -
size: number (default:1)- Specifies the number of displayed months, weeks or days. -
allDay: boolean (defaulttrue) - Show or hide the all day events. -
currentTimeIndicator: boolean (defaulttrue) - Show or hide the current time indicator. -
days: boolean (defaulttrue) - Show or hide week days above the scheduler grid. -
startDay: number (default0) - Specifies the first visible weekday of the view. Sunday is 0, Monday is 1, etc. Days outside of thestartDayandendDayrange will not be visible. Should not be mistaken for the firstDay option, which sets the first day of the week, and, if not set, is defined by the localization. -
endDay: number (default6) - Specifies the last visible weekday of the view. Sunday is 0, Monday is 1, etc. -
startTime: string (default'00:00') - Set the start time of scheduler column. Hours and minutes can be specified in the same string, example:'09:30'. -
endTime: string (default'24:00') - Set the end time of scheduler column. Hours and minutes can be specified in the same string, example:'18:30'. -
hideEmptyColumns: boolean (defaultfalse) - Hide the empty columns in the scheduler view. If set totrue, the scheduler will not display columns without events. -
hideInvalidColumns: boolean (defaultfalse) - Hide the fully invalid columns in the scheduler view. If set totrue, the scheduler will not display fully invalid columns. -
maxEventStack: 'all' | 'auto' | number - Limit the number of displayed events. When the number of overlapping events reaches the specified value, a "more" button will be displayed which opens a popover showing the rest of the events.- If it is a
number, it specifies how many events will be displayed before the "more" button appears. - If set to
'all', all events will be displayed. - If set to
'auto', the component will decide how many events can be placed inside the column, based on theminEventWidthview option and the actual column width.
- If it is a
-
minEventWidth: number - Specifies the minimum event width. Will be used whenmaxEventStack: 'auto'is used. -
timeCellStep: number (default60) - Set the step of the grid cells in minutes. Supported values: 1, 5, 10, 15, 20, 30, 60, 120, 180, 240, 360, 480, 720, 1440. -
timeLabelStep: number (default60) - Set the step of the time labels in minutes. Supported values: 1, 5, 10, 15, 20, 30, 60, 120, 180, 240, 360, 480, 720, 1440. -
timezones: Array<string | object> - Display times in multiple timezones on the time scale and time indicator. The timezones array can contain timezone strings or objects with timezone and label properties. Timezone strings must use the name from the IANA time zone database. If no label is provided, the time column label will be UTC +/- the timezone offset.timezones: ['Europe/Berlin','Europe/Bucharest']timezones: [{ timezone: 'America/Chicago', label: 'CHI'},{ timezone: 'America/New_York', label: 'NY'}]
timeline: Configures the timeline view. Properties:
type: 'day' | 'week' | 'month' | 'year' (default'week') - Sets the timeline type.size: number (default:1)- Specifies the number of displayed years, months, weeks or days.resolutionHorizontal: 'hour', 'day', 'week', 'month', 'quarter', 'year' (default 'hour') - Sets the horizontal resolution of the timeline. In case of hourly resolution, the columns can be split to minutes (1, 5, 15, 20, 30) or merge to multiple hours (2, 3, 4, 6, 8, 12) using thetimeCellStepandtimeLabelStepproperties.currentTimeIndicator: boolean - Show or hide the current time indicator. Defaults totrue, when the horizontal resolution is less than a day.hideEmptyRows: boolean (defaultfalse) - Hide the empty rows in the timeline view. If set totrue, the timeline will not display rows without events.infoParent resources will always be displayed, even when empty.
hideInvalidRows: boolean (defaultfalse) - Hide the fully invalid rows in the timeline view. If set totrue, the timeline will not display the fully invalid rows.infoParent resources will always be displayed, even when fully invalid.
startDay: number (default0) - Specifies the first visible weekday of the view. Sunday is 0, Monday is 1, etc. Days outside of thestartDayandendDayrange will not be visible. Should not be mistaken for the firstDay option, which sets the first day of the week, and, if not set, is defined by the localization.endDay: number (default6) - Specifies the last visible weekday of the view. Sunday is 0, Monday is 1, etc.maxEventStack: 'all' | number - Limit the number of displayed events. When the number of overlapping events reaches the specified value, a "more" button will be displayed which opens a popover showing the rest of the events.- If it is a
number, it specifies how many events will be displayed before the "more" button appears. - If set to
'all', all events will be displayed.
- If it is a
startTime: string (default'00:00') - Set the start time of the timeline days. Hours and minutes can be specified in the same string, example:'09:30'.endTime: string (default'24:00') - Set the end time of the timeline days. Hours and minutes can be specified in the same string, example:'18:30'.timeCellStep: number (default60) - Set the step of the grid cells in minutes. Supported values: 1, 5, 10, 15, 20, 30, 60, 120, 180, 240, 360, 480, 720, 1440.timeLabelStep: number (default60) - Set the step of the time labels in minutes. Supported values: 1, 5, 10, 15, 20, 30, 60, 120, 180, 240, 360, 480, 720, 1440.eventHeight: 'variable' | 'equal' (default 'equal') - Specifies wether the height of the events is equal or variable.eventList: boolean (defaultfalse) - Iftrue, transforms the layout into a summary view. The events are listed in the appropriate cell one after the other.rowHeight: 'variable' | 'equal' (default 'variable') - Controls the height of the timeline rows. By default rows will have variable height and will expand to accommodate the displayed events. If it is set to'equal', the rows will have equal heights.virtualScroll: boolean (defaulttrue) - Enable or disable virtual scroll.weekNumbers: boolean (defaultfalse) - Show or hide week numbers.
view: {
calendar: {
type: 'week',
size: 2
},
agenda: {
type: 'week',
size: 2
}
}
width
string | number
Sets the width of the component.
Default value: undefined
zoomLevel
string | number
Specifies the current zoom level of the timeline view.
The zoom levels can be listed using the zoomLevels property of the timeline inside the view option.
Default value: undefined
Events
The Eventcalendar ships with different event hooks for deep customization. Events are triggered through the lifecycle of the component where you can tie in custom functionality and code.
@cell-click
(args: MbscCellClickEvent, inst: EventcalendarBase) => void
Triggered when a cell is clicked on the calendar day, scheduler cell, or timeline cell.
Parameters:
-
args - The event object has the following properties:
date: Date - The date of the clicked cell.domEvent: Event - The DOM event of the click.events: Array<MbscCalendarEvent> - The events for the clicked date.resource: string | number - The id of the resource where the cell was clicked, if resources are set.selected: boolean - Specifies if the day is currently selected or not (before it was clicked).source: 'calendar' | 'schedule' | 'timeline' - The view where the cell was clicked.target: HTMLElement - The DOM element of the clicked cell.
-
inst - The component instance.
@cell-double-click
(args: MbscCellClickEvent, inst: EventcalendarBase) => void
Triggered when a cell is double-clicked on the calendar day, scheduler cell, or timeline cell.
Parameters:
-
args - The event argument with the following properties:
date: Date - The date of the clicked cell.domEvent: Event - The DOM event of the click.events: Array<MbscCalendarEvent> - The events for the clicked date.resource: string | number - The id of the resource where the cell was clicked, if resources are set.selected: boolean - Specifies if the day is currently selected or not (before it was clicked).source: 'calendar' | 'schedule' | 'timeline' - The view where the cell was clicked.target: HTMLElement - The DOM element of the clicked cell.
-
inst - The component instance.
@cell-hover-in
(args: MbscCellHoverEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer hovers a day on the calendar view (does not apply for agenda view).
Parameters:
-
args - The event argument with the following properties:
colors: Array<MbscCalendarColor> - The colors for the hovered cell.date: Date - The date of the hovered day.events: Array<MbscCalendarEvent> - The events for the hovered cell.invalids: Array<MbscCalendarInvalid> - The invalid dates for the hovered cell.labels: Array<MbscCalendarLabel> - If the cell has labels, contains the label objects for the hovered cell.marked: Array<MbscCalendarMarked> - If the cell is marked, contains the marked objects for the hovered cell.selected: boolean - Specifies if the cell is currently selected or not (in case of calendar view).target: HTMLElement - The DOM element of the cell.resource: MbscResource - The resource object for the hovered cell.
-
inst - The component instance.