# [v5] Mobiscroll for JavaScript — Full Documentation
> Complete Mobiscroll v5 JavaScript documentation including Eventcalendar, Datepicker, Select, Popup, Forms, theming, and guides. This documentation refers to Mobiscroll version 5.35.0.
This file contains all documentation content in a single document following the llmstxt.org standard.
## Getting started with Mobiscroll for JavaScript
Depending on the target project, the Mobiscroll library can be installed into:
1. A web application with module loaders (like webpack or similar app building tools)
2. Simple HTML web pages (with script and link tags)
For simple web pages the Mobiscroll CLI is not required and you can follow the [install guide for web pages](#web-pages).
To install the Mobiscroll library to your web application, you will need the Mobiscroll CLI.
## Install the CLI
Install the Mobiscroll CLI from NPM (you'll only have to do it once).
```bash
npm install -g @mobiscroll/cli
```
:::info
On Windows client computers, the execution of PowerShell scripts is disabled by default. When using Powershell, to be able to install the Mobiscroll CLI you will need to set the following execution policy:
```
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
```
Make sure to read the message displayed after executing the command and follow the instructions.
:::
## Starting with the trial
Start a free trial by entering your email address on the [Mobiscroll homepage](https://mobiscroll.com) and create your account. When asked, enter your first name, set a password and you're ready to go!
### This is how the free trial works:
1. You can try Mobiscroll for free.
2. The trial needs an active connection to Mobiscroll servers for validation. Don't worry, the licensed product will work offline with downloadable resource files.
Read about the [differences between trial and licensed products](http://help.mobiscroll.com/trials/what-are-the-limitations-of-the-trial).
3. You can upgrade to the licensed product at any time during or after your trial.
### Installing a trial package
To install the Mobiscroll Trial, you will need to open a terminal window in the root folder of you project and run the following command:
```bash
mobiscroll config javascript --trial
```
:::caution The CLI handles everything — don't do these manually
- **Do not run `npm login`** — `mobiscroll config` sets up Mobiscroll's private NPM registry authentication automatically.
- **Do not run `npm install @mobiscroll/...`** — the CLI adds and installs the Mobiscroll package for you.
- **Do not set up a license key manually** — the CLI configures your license when you run `mobiscroll config`.
:::
By default the CLI will install the [ESM Bundle](../core-concepts/esm-bundle) of the trial package. You might need to [register components for the auto-initialization](../core-concepts/esm-bundle.md#manual-vs-auto-initialization) feature to work.
## Installing from NPM
To install the Mobiscroll library from NPM, you will need to open a terminal window in the root folder of you project and run the following command:
```bash
mobiscroll config javascript
```
:::caution The CLI handles everything — don't do these manually
- **Do not run `npm login`** — `mobiscroll config` sets up Mobiscroll's private NPM registry authentication automatically.
- **Do not run `npm install @mobiscroll/...`** — the CLI adds and installs the Mobiscroll package for you.
- **Do not set up a license key manually** — the CLI configures your license when you run `mobiscroll config`.
:::
:::info
If you're working behind a proxy, additional configuration might be needed. Please check the [proxy configuration options](https://mobiscroll.com/docs/core-concepts/cli#using-the-cli-behind-a-proxy) of the CLI.
:::
For the components to work, you will also need to import the css file of the installed library under the node_modules folder (at @mobiscroll/javascript/dist/css/mobiscroll.min.css).
If you are [using SCSS](https://sass-lang.com/), you will also find a full and a modular `.scss` file in the same directory.
By default the CLI will install the [ESM Bundle](../core-concepts/esm-bundle). You might need to [register components for the auto-initialization](../core-concepts/esm-bundle.md#manual-vs-auto-initialization) feature to work.
## Setting up for CI/CD
The config command will create a file named `.npmrc` in the project root, containing the access tokens to the Mobiscroll NPM registry. Commit this file into the repository to ensure the package will install for other team members and in CI/CD environments.
When used with Yarn 2 or 3, a different file is used, named `.yarnrc.yml`. Make sure this is also added to the repository.
When used with Docker, make sure to copy the `.npmrc` or `.yarnrc.yml` file together with `package.json`, to make sure that the install process will have access to the Mobiscroll NPM registry.
Here's a Dockerfile example:
```bash
FROM node:18.12.0 as build
ENV NODE_ENV production
WORKDIR /app
COPY package.json package-lock.json .npmrc ./
RUN npm install
COPY . .
# ...
```
:::info
It is recommended to set up and use [team NPM accounts](http://help.mobiscroll.com/en/articles/8095168-team-npm-accounts) instead of individual developer credentials for installing Mobiscroll.
:::
## Installing manually
A downloaded package can be installed into a webapp with [module loaders](../core-concepts/esm-bundle) as well as a [simple web page](#web-pages) by including the code into the html.
On the [download page](https://download.mobiscroll.com/) a custom package can be built by picking only the components, themes, languages and additional modules you need.
When [building your package](http://help.mobiscroll.com/en/articles/974201-download-builder), select the required components and other resources, then hit the download button.
**1. Copy Mobiscroll into your app**
Extract the zip file you just downloaded, then grab the `js`, `src` and `css` folders and copy it into src/lib/mobiscroll folder of your JavaScript app. If there is no such folder available, you can create it.
**2. Run the config command**
Run the config command in the root folder of your app in a terminal window.
```bash
mobiscroll config javascript --no-npm
```
For the components to work, you will also need to import the css file of the installed library under the node_modules folder (at @mobiscroll/javascript/dist/css/mobiscroll.min.css).
If you are [using SCSS](https://sass-lang.com/), you will also find a full and a modular `.scss` file in the same directory.
### Web pages
To include a downloaded package to a simple website, unzip the contents of the downloaded zip file. Copy the `css` and `js` folders to your project, next to your html file. A script and a stylesheet will need to be included into the html like this:
```html title="Your html file, for example index.html"
```
Then you can use the initialization functions from the mobiscroll namespace:
```javascript
mobiscroll.eventcalendar('#my-div', {
view: { schedule: { type: 'day' }},
});
mobiscroll.datepicker('#my-other-div', {
select: 'range',
});
```
:::info ESM Bundle
Would you like to use Mobiscroll as an ESM (ECMAScript Module) bundle to reduce the bundle size? It's possible, [read this guide](../core-concepts/esm-bundle) on how to make it work.
:::
---
## Mobiscroll for JavaScript
Mobiscroll for JavaScript is a collection of UI components. It works as a standalone library without any other required library or framework.
It helps deliver great mobile apps, websites with a great user experience and in getting five-star app store reviews. The controls follow platform UX guidelines and can be styled with the Theme Builder for a perfect fit.
:::info Supported platforms
Android 5+ including Android 16, iOS 9+ including iOS 26 and all major desktop browsers, including Chrome 43+, Firefox 16+, Safari 9+, Edge 12+ and Internet Explorer 11+.
:::
## Introduction
The following sections help you get started and learn more on the Mobiscroll library.
## UI Components
Delve right into how the individual components work and learn about their API by following the links below.
## Legacy docs
If you are looking for the documentation for a specific version that you don't find in the dropdown at the top of the page, you can check our legacy documentation under [this link](https://docs.mobiscroll.com/5-29-0/).
---
## Accessibility
## Overview
We want our products to be fully experienced by the widest number of users including disabled users.
We take accessibility pretty seriously and spent a couple of iterations on it. By adhering to standards like [WAI-ARIA](http://www.w3.org/WAI/PF/aria-practices/), [Section 508](http://www.section508.gov/), and [WCAG 2.2](https://www.w3.org/TR/WCAG/) we create accessible products that can be used well together with an assistive technology, like a screen reader.
Since the technology has evolved, nowadays not only basic text-driven experiences have to be made accessible, but also other features.
## Accessibility Compliance
Mobiscroll components are designed to support WCAG-based accessibility standards and can be used to build applications aligned with major public-sector accessibility frameworks worldwide.
They are largely aligned with WCAG 2.2 A and AA requirements, with strong support for keyboard navigation, WAI-ARIA, and screen reader compatibility.
However, full WCAG AA compliance is not yet achieved, as WCAG 1.4.3 Contrast (Minimum) is not fully supported in all cases. This known limitation is actively being addressed in upcoming releases.
Mobiscroll can therefore support the development of applications targeting major global accessibility regulations, while full compliance depends on the complete application implementation and resolving this remaining gap.
#### Mobiscroll can be used in applications targeting frameworks such as:
- 🇪🇺 EN 301 549 (European Union)
- 🇫🇷 RGAA (France)
- 🇺🇸 Section 508 (United States)
- 🇨🇦 AODA (Canada)
As well as other WCAG-aligned national regulations:
- 🇩🇪 BITV 2.0 (Germany)
- 🇮🇹 Legge Stanca (Italy)
- 🇪🇸 UNE 139803 (Spain)
- 🇳🇱 DigiToegankelijk (Netherlands)
- 🇸🇪 DOS-lagen (Sweden)
- 🇩🇰 Web Accessibility Act (Denmark)
- 🇫🇮 Act on Digital Services (Finland)
- 🇳🇴 Universal Design of ICT (Norway)
- 🇬🇧 Public Sector Accessibility Regulations (UK)
- 🇯🇵 JIS X 8341-3 (Japan)
- 🇮🇱 Standard 5568 (Israel)
#### Compliance responsibility
Mobiscroll provides accessible UI components intended to support WCAG-based development.
It does not, by itself, ensure that an application is fully compliant with accessibility regulations.
Organizations using Mobiscroll are responsible for:
- publishing an accessibility statement
- maintaining accessibility monitoring and audits
- implementing accessibility governance processes
- ensuring content, structure, and workflows meet accessibility requirements
## WCAG 2.2
The [Web Content Accessibility Guidelines (WCAG)](https://www.w3.org/WAI/standards-guidelines/wcag/) provide guidelines developed by the World [Wide Web Consortium (W3C)](https://www.w3.org/) to ensure web content is accessible to people with disabilities. WCAG 2.2 establishes a framework of accessibility principles and their associated success criteria. The level of accessibility conformance achieved by a web application is determined by the extent to which it meets these success criteria, categorized into three levels: A, AA, and AAA.
While Mobiscroll components are not fully compliant with WCAG 2.2 at this time, we are committed to enhancing their accessibility. We are actively working on improving compliance and continuously making progress.
The guidelines and success criteria are organized around the following four principles:
### [1. Perceivable](https://www.w3.org/TR/WCAG22/#perceivable)
Information and user interface components must be presentable to users in ways they can perceive.
Guidelines
Level
Compatibility
1.1 Text Alternatives
1.1.1 Non-text Content
A
Supported
1.2 Time-based Media
1.2.1 Audio-only and Video-only (Prerecorded)
A
Not Applicable
1.2.2 Captions (Prerecorded)
A
Not Applicable
1.2.3 Audio Description or Media Alternative (Prerecorded)
A
Not Applicable
1.2.4 Captions (Live)
AA
Not Applicable
1.2.5 Audio Description (Prerecorded)
AA
Not Applicable
1.2.6 Sign Language (Prerecorded)
AAA
Not Applicable
1.2.7 Extended Audio Description (Prerecorded)
AAA
Not Applicable
1.2.8 Media Alternative (Prerecorded)
AAA
Not Applicable
1.2.9 Audio-only (Live)
AAA
Not Applicable
1.3 Adaptable
1.3.1 Info and Relationships
A
Supported
1.3.2 Meaningful Sequence
A
Supported
1.3.3 Sensory Characteristics
A
Supported
1.3.4 Orientation
AA
Supported
1.3.5 Identify Input Purpose
AA
Supported
1.3.6 Identify Purpose
AAA
Supported
1.4 Distinguishable
1.4.1 Use of Color
A
Supported
1.4.2 Audio Control
A
Not Applicable
1.4.3 Contrast (Minimum)
AA
Not fully supported
1.4.4 Resize Text
AA
Supported
1.4.5 Images of Text
AA
Not Applicable
1.4.6 Contrast (Enhanced)
AAA
Not fully supported
1.4.7 Low or No Background Audio
AAA
Not Applicable
1.4.8 Visual Presentation
AAA
Supported
1.4.9 Images of Text (No Exception)
AAA
Not Applicable
1.4.10 Reflow
AA
Supported
1.4.11 Non-text Contrast
AA
Supported
1.4.12 Text Spacing
AA
Supported
1.4.13 Content on Hover or Focus
AA
Supported
### [2. Operable](https://www.w3.org/TR/WCAG22/#operable)
User interface components and navigation must be operable.
Guidelines
Level
Compatibility
2.1 Keyboard Accessible
2.1.1 Keyboard
A
Supported
2.1.2 No Keyboard Trap
A
Supported
2.1.3 Keyboard (No Exception)
AAA
Supported
2.1.4 Character Key Shortcuts
A
Not Applicable
2.2 Enough Time
2.2.1 Timing Adjustable
A
Supported
2.2.2 Pause, Stop, Hide
A
Not Applicable
2.2.3 No Timing
AAA
Supported
2.2.4 Interruptions
AAA
Supported
2.2.5 Re-authenticating
AAA
Not Applicable
2.2.6 Timeouts
AAA
Not Applicable
2.3 Seizures and Physical Reactions
2.3.1 Three Flashes or Below Threshold
A
Supported
2.3.2 Three Flashes
AAA
Supported
2.3.3 Animation from Interactions
AAA
Supported
2.4 Navigable
2.4.1 Bypass Blocks
A
Not Applicable
2.4.2 Page Titled
A
Not Applicable
2.4.3 Focus Order
A
Supported
2.4.4 Link Purpose (In Context)
A
Not Applicable
2.4.5 Multiple Ways
AA
Not Applicable
2.4.6 Headings and Labels
AA
Supported
2.4.7 Focus Visible
AA
Supported
2.4.8 Location
AAA
Not Applicable
2.4.9 Link Purpose (Link Only)
AAA
Not Applicable
2.4.10 Section Headings
AAA
Not Applicable
2.4.11 Focus Not Obscured (Minimum)
AA
Supported
2.4.12 Focus Not Obscured (Enhanced)
AAA
Supported
2.4.13 Focus Appearance
AAA
Not fully supported
2.5 Input Modalities
2.5.1 Pointer Gestures
A
Supported
2.5.2 Pointer Cancellation
A
Supported
2.5.3 Label in Name
A
Supported
2.5.4 Motion Actuation
A
Not Applicable
2.5.5 Target Size (Enhanced)
AAA
Not fully supported
2.5.6 Concurrent Input Mechanisms
AAA
Supported
2.5.7 Dragging Movements
AA
Supported
2.5.8 Target Size (Minimum)
AA
Supported
### [3. Understandable](https://www.w3.org/TR/WCAG22/#understandable)
Information and the operation of user interface must be understandable.
Guidelines
Level
Compatibility
3.1 Readable
3.1.1 Language of Page
A
Not Applicable
3.1.2 Language of Parts
AA
Not Applicable
3.1.3 Unusual Words
AAA
Not Applicable
3.1.4 Abbreviations
AAA
Supported
3.1.5 Reading Level
AAA
Not Applicable
3.1.6 Pronunciation
AAA
Not Applicable
3.2 Predictable
3.2.1 On Focus
A
Supported
3.2.2 On Input
A
Not Applicable
3.2.3 Consistent Navigation
AA
Not Applicable
3.2.4 Consistent Identification
AA
Not Applicable
3.2.5 Change on Request
AAA
Not Applicable
3.2.6 Consistent Help
A
Not Applicable
3.3 Input Assistance
3.3.1 Error Identification
A
Supported
3.3.2 Labels or Instructions
A
Supported
3.3.3 Error Suggestion
AA
Supported
3.3.4 Error Prevention (Legal, Financial, Data)
AA
Not Applicable
3.3.5 Help
AAA
Not Applicable
3.3.6 Error Prevention (All)
AAA
Not Applicable
3.3.7 Redundant Entry
A
Not Applicable
3.3.8 Accessible Authentication (Minimum)
AA
Not Applicable
3.3.9 Accessible Authentication (Enhanced)
AAA
Not Applicable
### [4. Robust](https://www.w3.org/TR/WCAG22/#robust)
Content must be robust enough that it can be interpreted reliably by a wide variety of user agents, including assistive technologies.
Guidelines
Level
Compatibility
4.1 Compatible
4.1.1 Parsing (Obsolete and removed)
-
-
4.1.2 Name, Role, Value
A
Supported
4.1.3 Status Messages
AA
Supported
### WCAG compliance for each component
WCAG compliance levels for each Mobiscroll component:
- [Datepicker](../datepicker/accessibility#wcag-22)
- [Eventcalendar](../eventcalendar/accessibility#wcag-22)
- [Select](../select/accessibility#wcag-22)
- [Popup](../popup/accessibility#wcag-22)
- [Alerts & notifications](../notifications/accessibility#wcag-22)
- [Forms](../forms/accessibility#wcag-22)
## Section 508
### [Section 1194.21](https://www.access-board.gov/ict/#d21) - Software applications and operating systems
The following table shows the level of support that Mobiscroll provides for the Section 1194.21
Criteria
Supporting features
Remarks
(a) When software is designed to run on a system that has a keyboard product functions shall be executable from a keyboard where the function itself or the result of performing a function can be discerned textually.
Supported
Native html keyboard support kept where relevant, custom key bindings added where needed
(b) Applications shall not disrupt or disable activated features of other products that are identified as accessibility features where those features are developed and documented according to industry standards. Applications also shall not disrupt or disable activated features of any operating system that are identified as accessibility features where the application programming interface for those accessibility features has been documented by the manufacturer of the operating system and is available to the product developer.
Supported
Mobiscroll does nothing to disrupt or disable activated accessibility features
(c) A well-defined on-screen indication of the current focus shall be provided that moves among interactive interface elements as the input focus changes. The focus shall be programmatically exposed so that assistive technology can track focus and focus changes.
Supported
In some cases the browser’s native focus indicator styling is overwritten with custom styling
(d) Sufficient information about a user interface element including the identity operation and state of the element shall be available to assistive technology. When an image represents a program element the information conveyed by the image must also be available in text.
Supported
Using WAI-ARIA,roles and attributes where applicable
(e) When bitmap images are used to identify controls status indicators or other programmatic elements the meaning assigned to those images shall be consistent throughout an application’s performance.
Not Applicable
(f) Textual information shall be provided through operating system functions for displaying text. The minimum information that shall be made available is text content text input caret location and text attributes.
Not Applicable
(g) Applications shall not override user selected contrast and color selections and other individual display attributes.
Not Applicbale
(h) When animation is displayed the information shall be displayable in at least one non-animated presentation mode at the option of the user.
Not Applicable
(i) Color coding shall not be used as the only means of conveying information indicating an action, prompting a response or distinguishing a visual element.
Not Applicable
(j) When a product permits a user to adjust color and contrast settings a variety of color selections capable of producing a range of contrast levels shall be provided.
Not Applicable
(k) Software shall not use flashing or blinking text, objects, or other elements having a flash or blink frequency greater than 2 Hz and lower than 55 Hz.
Supported
No flashing or blinking elements are used
(l) When electronic forms are used, the form shall allow people using assistive technology to access the information, field elements, and functionality required for completion and submission of the form, including all directions and cues.
Supported
Mobiscroll Forms are accessible to assistive technologies
### [Section 1194.22](https://www.access-board.gov/ict/#d22) - Web-based intranet and Internet information and applications
The following table shows the level of support that Mobiscroll provides for the Section 1194.21
Criteria
Supporting features
Remarks
(a) A text equivalent for every non-text element shall be provided (e.g., via “alt", “longdesc", or in element content).
Supported
(b) Equivalent alternatives for any multimedia presentation shall be synchronized with the presentation.
Not Applicable
No multimedia is used
(c) Web pages shall be designed so that all information conveyed with color,is also available without color for example from context or markup.
Supported
(d) Documents shall be organized so they are readable without requiring an associated style sheet.
Not fully supported
We’re providing an UI Framework for styling content. Removing style sheets doesn’t make sense
(e) Redundant text links shall be provided for each active region of a server-side image map.
Not Applicable
No image maps are used
(f) Client-side image maps shall be provided instead of server-side image maps except where the regions cannot be defined with an available geometric shape.
Not Applicable
No image maps are used
(g) Row and column headers shall be identified for data tables.
Not Applicable
No data tabels are used
(h) Markup shall be used to associate data cells and header cells for data tables that have two or more logical levels of row or column headers.
Not Applicable
No data tabels are used
(i) Frames shall be titled with text that facilitates frame identification and navigation.
Not Applicable
No frames are used
(j) Pages shall be designed to avoid causing the screen to flicker with a frequency greater than 2 Hz and lower than 55 Hz.
Supported
No flashing or blinking elements are used
(k) A text-only page with equivalent information or functionality shall be provided to make a web site comply with the provisions of this part, when compliance cannot be accomplished in any other way. The content of the text-only page shall be updated whenever the primary page changes.
Not Applicable
The developer is responsible for providing text-only content for pages that use Mobiscroll
(l) When pages utilize scripting languages to display content or to create interface elements the information provided by the script shall be identified with functional text that can be read by assistive technology.
Supported
Mobiscroll provides keyboard navigation support and screen reader support (via ARIA attributes)
(m) When a web page requires that an applet, plug-in or other application be present on the client system to interpret page content the page must provide a link to a plug-in or applet that complies with §1194.21(a),through (l).
Not Supported
(n) When electronic forms are designed to be completed on-line, the form shall allow people using assistive technology to access the information field elements and functionality required for completion and submission of the form including all directions and cues.
Supported
Mobiscroll Forms are accessible to assistive technologies
(o) A method shall be provided that permits users to skip repetitive navigation links.
Not Applicable
(p) When a timed response is required the user shall be alerted and given sufficient time to indicate more time is required.
Not Applicable
## WAI-ARIA Support
WAI-ARIA is a World Wide Web Consortium specification that was designed to be a framework for web developers. This can be used in developing applications that leverage Ajax, scripting and other so called “rich application" techniques. This framework has clear specifications about steps that developers can use in order to make their applications more accessible to assistive technologies.
WAI-ARIA’s role is to fill the gap between rich applications and disabled users by using additional metadata with the help of HTML element attributes that screen readers can use to reason about a control or DOM element. These attributes, like role, aria-haspopup, aria-selected and others provide vital information to screen readers, which can then be used to provide a richer level of interaction with applications and websites.
Here is the complete list of WAI-ARIA attributes used by Mobiscroll:
- `role="dialog"` for popups and pickers
- `role="grid"` for calendar view
- `role="row"` for calendar view rows
- `role="gridcell"` for calendar views cells
- `role="listbox"` for scroller wheels
- `role="option"` for scroller wheel items
- `role="button"` for button controls
- `aria-live` for announcements
- `aria-hidden` for elements which are not visible and should not be read by screen readers
- `aria-label` for controls without text or icon buttons
- `aria-selected` for indicating selected value on wheels and calendar days
- `aria-multiselectable` for multiple select
- `aria-disabled` for disabled items (wheel items, buttons, calendar days)
## Support Right-To-Left (RTL) Languages
Only a few languages in the world use RTL text direction, but these languages cover over a billion people.
Beside it’s internationalization characteristic RTL is about making user experiences more accessible for users working in Right-to-left languages like, so we are considering this as an accessibility feature as well.
Mobiscroll supports RTL for every component, which can be activated with the `rtl: true` option.
## Keyboard Support
Mobiscroll ensures that your users can access the full capabilities of widgets using just the keyboard.
The following keyboard bindings are used by Mobiscroll:
- [Datepicker](../datepicker/accessibility)
- [Eventcalendar](../eventcalendar/accessibility)
- [Select](../select/accessibility)
- [Popup](../popup/accessibility)
- [Alerts & notifications](../notifications/accessibility)
- [Form components](../forms/accessibility)
---
## Mobiscroll CLI
## Overview
The Mobiscroll Command Line Interface helps to install and configure the mobiscroll library into a project.
:::info
Requires Node.js 11 or newer.
:::
## Installation
Using the node package manager (npm), the Mobiscroll CLI can be installed with the following command:
```bash
$ npm install -g @mobiscroll/cli
```
:::info
On Windows client computers, the execution of PowerShell scripts is disabled by default. When using Powershell, to be able to install the Mobiscroll CLI you will need to set the following [execution policy](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.3):
`Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned`
Make sure to read the message displayed after executing the command and follow the instructions.
:::
## Config
Configures your current project with the Mobiscroll resources and dependencies. Use the `--version` option to define which supported main version would you like to install:
```bash title='Install the latest version'
$ mobiscroll config [types] [options]
```
```bash title='Install the latest v4 version'
$ mobiscroll config [types] [options] --version=4
```
Options:
- `-t`, `--trial`: The project will be configured with the trial version.
- `-n`, `--no-npm`: This option can be used if you are building a custom package with the [download builder](http://help.mobiscroll.com/en/articles/974201-download-builder). Mobiscroll resources won't be installed from npm. In this case the Mobiscroll resources must be copied manually to the `src/lib` folder from the downloaded package.
- `-h`, `--help`: Output usage information.
- `--proxy [url]`: Define a proxy URL which will be passed to the internal requests.
- `--scss`: The project will be configured with scss styles instead of css.
- `--css`: The project will be configured with css styles instead of scss.
- `--legacy-peer-deps`: This option will be passed to internally executed `npm install` command.
- `--version [version]`: Pass the Mobiscroll version which you want to install. It supports semver versions (`--version="4.10.7"`) and main versions (`--version="4"`). In case of main version it will install the latest package available.
Types:
- `angular`: Use it for configuring Angular 4+ applications.
- `ionic`: Use it for configuring Ionic 2.2.0+ applications.
- `javascript`: Use it for configuring JavaScript applications. Use it with frameworks like: Knockout, Ember.js...
- `jquery`: Use it for configuring jQuery 1.7+ applications.
- `react`: Use it for configuring React 16.2+ applications.
- `vue`: Use it for configuring Vue 3+ applications.
## Login
Logs you in to the Mobiscroll npm registry. (Use the `--global` flag if you want to login globally).
```bash
$ mobiscroll login [options]
```
Options:
- `-h`, `--help`: output usage information.
## Logout
Logs you out from the Mobiscroll npm registry. (Use the `--global` flag if you want to log out globally).
```bash
$ mobiscroll logout [options]
```
Options:
- `-h`, `--help`: output usage information.
## Using the CLI behind a proxy
If you're behind a proxy, the `mobiscroll` command might not work out of the box. There are multiple ways to solve this.
1. Using environment variables
The preferred way is to set the `http_proxy` and `https_proxy` environment variables on your system. This is usually needed for other CLI commands as well which are making requests and needs to be routed through a proxy server as well.
```bash title='Mac OS / Linux'
$ export http_proxy=http://myuser:mypassword@myproxy.com:1234
$ export https_proxy=http://myuser:mypassword@myproxy.com:1234
```
This will set the environment variables for the current terminal session. To permanently set the variables, add the above lines to your user's `~/.bash_profile` or `~/.zshrc` files.
```bash title='Windows'
$ setx HTTP_PROXY "http://myuser:mypassword@myproxy.com:1234"
$ setx HTTPS_PROXY "http://myuser:mypassword@myproxy.com:1234"
```
The `setx` command will permanently set the environment variables.
2. Using the `--proxy` parameter
The quick and dirty method without the need to modify any system configuration, is to pass the proxy address to the `mobiscroll config` command using the `--proxy` option. This will be used for any external request made to our servers or the npm registry.
```bash
$ mobiscroll config [framework] --proxy http://myuser:mypassword@myproxy.com:1234
```
---
## ESM Bundle
## Overview
With every Mobiscroll package we provide an ESM bundle, so it can be used as a JavaScript Module. This way many bundlers (for example Rollup, Webpack, etc...) can take advantage of the tree-shaking technique and eliminate dead code. This reduces the bundle size to only what is actually used in the application.
The ESM bundles are under the `esm5` folder of the package.
## Using components
The Mobiscrol ESM bundle has all the components the regular bundle has, but it omits a few setup steps in order to be tree-shakeable. One of these steps is the [registering of components](#registering-components), that needs to be done manually for the auto-initialization to work.
### Manual vs Auto initialization
All of the Mobiscroll components can be initialized manually using their initialization functions:
```javascript
button('#my-element'); // initialize a button on the element with id 'my-element'
```
Some Mobiscroll components can also be initialized using a html attribute that automatically initializes the component:
```html
```
:::caution
When using an ESM bundles the auto-initialization will work only after [registering the components](#registering-components).
:::
### Registering components
In ESM bundles, for the auto-initialization to work, the components will need to be registered. This registration can be done using the `registerComponent` function.
Manually initializing components will work the same way in both regular and esm bundles.
```javascript
// highlight-start
registerComponent, // import the registerComponent function used to register the components for auto-initialization
Button, // import component classes that needed to be regitered
// highlight-end
Checkbox,
Segmented,
SegmentedGroup
} from '.\esm5\mobiscroll.javascript.min.js';
// register components for auto-initialization
// highlight-next-line
registerComponent(Button);
registerComponent(Checkbox);
registerComponent(Segmented);
registerComponent(SegmentedGroup);
```
The above code will enable the use of the mbsc-button, mbsc-checkbox, mbsc-segmented and mbsc-segmented-group attributes on elements.
## Setting up the ESM Bundle
Using the ESM bundle depends on the project structure you have. Here are a few examples on how to set up in different environments.
### Using ES6 Modules without bundlers
Since modern browsers started supporting native JavaScript modules, ESM bundles can be used directly in them. This "direct" usage means, that initialization functions can be imported into scripts denoted as modules. Scripts can be denoted as modules with the `type="module"` attribute.
:::info
Please note that this may not be supported by all browsers. Check out the browser support for native JavaScript Modules [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#browser_support)!
:::
The following example demonstrates how to import the Mobiscroll initialization functions into scripts. To create the file structure download a JavaScript package from the [download builder](https://download.mobiscroll.com/) and grab the `js`, `css` and `esm5` folders and copy to an empty directory. Create an `index.html` file with the following content:
```html title='index.html'
Getting Started
```
What you can see here, is:
- the loading of the stylesheet in the header,
- the markup of an input element wrapped in a label and
- an empty script tag with the attribute of type="module".
The file structure you will need is the following:
```bash title='File structure'
File structure
/
|--css/
|--mobiscroll.javascript.min.css
|--icons_mobiscroll.ttf
|--icons_mobiscroll.woff
|--esm5/
|--mobiscroll.javascript.min.js
|--js/
|--mobiscroll.javascript.min.js
|--index.html
```
In the script tag, you can import the datepicker initialization function and use it on the input to create the datepicker as follows:
```javascript
```
To also enhance the input, and make it a Mobiscroll Input, you will need to add the `mbsc-input` attribute to the input element, and setup the [auto-initialization](#manual-vs-auto-initialization).
Add the attribute to the input:
```javascript
```
Register the auto-init of inputs:
```javascript
registerComponent(Input);
datepicker('#myInput', {
theme: 'ios'
});
```
This will enhance the input, and initialize the datepicker on it.
One important thing to note here is that opening the index.html in the browser won't work without a web server. That's because of a cross origin security policy applied by the browser, that won't load the mobiscroll script unless the `index.html` is on the same domain.
This limitation can be solved by using a simple web server. Here's an example of how to use a `http-server` from NPM (Node Package Manager).
### Simple web server for testing
Install the `http-server` via NPM, using the following command:
```bash
$ npm install -g http-server
```
Start the server in the same directory the index.html file is located by the following command:
```bash
$ npx http-server .\ -c-1
```
After starting the server, navigate to the `http://127.0.0.1:8080/` address. This will serve you the index.html file and the example will work now.
### Webpack
When using webpack to bundle your project's javascript, you can make use of the Mobiscroll CLI to install the Mobiscroll Package and then import in your files only what you need.
Here's the simplest example to start with:
```bash
File structure
/
|--dist/
|--bundle.js
|--index.html
|--node_modules/
|--src/
|--index.js
|--package.json
|--webpack.config.js
```
If you are doing this from scratch, you will need to install webpack and the webpack cli, as well as the css and style loader plugin. The later two is needed for the css imports to work.
```bash
$ npm install webpack webpack-cli style-loader css-loader --save-dev
```
After webpack is ready, we'll create a configuration file `webpack.config.js` in the root directory. This is standard configuration for webpack, to project the javascript to `bundle.js` and use the style and css loaders to import styles too. It will have the following content:
```javascript title='webpack.config.js'
const path = require('path');
module.exports = {
entry: './src/index.js',
mode: 'development',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
},
module: {
rules: [
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
],
},
};
```
The index html file will load only the `bundle.js` and will contain the markup for label and input elements:
```html title='index.html'
Getting Started
```
Next step is to install the Mobiscroll package via the CLI. Depending on what kind of license you have, you can have a package from the [download page](https://download.mobiscroll.com/) or you can have access to the NPM repository. Either way, you will have to use the `mobiscroll config javascript` command only with different options. If you have a package from the download page, please follow the guide there on how to install the package. If you have access to the npm package or you're on trial the following command will install it:
```bash
$ mobiscroll config javascript
```
The above command will install the mobiscroll package inside `node_modules` under `@mobiscroll/javascript`. All the components initialization functions can be imported from there as follows:
```javascript title='src\index.js'
export function main() {
console.log('main called.');
datepicker('#myInput', {
theme: 'ios'
});
}
main();
```
To build the bundle you can use the command webpack:
```bash
$ npx webpack
```
After that, opening the index.html file should show up with the datepicker working. To make the `mbsc-input` attribute work, you will have to register the input component for auto-initialization, just as described in [this section](#manual-vs-auto-initialization).
```javascript title='src\index.js'
registerComponent(Input);
export function main() {
console.log('main called.');
datepicker('#myInput', {
theme: 'ios'
});
}
main();
```
After building the bundle again, the input will be also enhanced to Mobiscroll Input, and when clicked the Datepicker will open, just as expected.
---
## Global options
Global options can be used to set options for all components used on a page.
Useful for speicifying application-wide options, like theme and locale.
You can use the `setOptions` utility function to specify the global options.
It can be called on initial page load or any time later.
All existing component on the page will be updated with the new options,
and components instantiated later will take into account the new global options.
Components can override the global options with their individual options,
e.g. if a component has a specific theme specified, it will override the global theme option.
```javascript
// Specify options globally for all components
mobiscroll.setOptions({
locale: localeDe,
theme: 'ios',
themeVariant: 'dark',
});
mobiscroll.datepicker('#my-input', {
select: 'range',
});
```
In the above example the datepicker will use the global options for the theme, locale and themeVariant.
---
## Instance
## Overview
In object-oriented programming (OOP), an instance is a specific realization of a class. Similarly, in the scope
of the Mobiscroll library, a component instance is a realization of the component class.
The instantiation (the creation of objects from a class) in case of the Mobiscroll components is done when the intialization function is called.
## Getting the instance
### Initialization
A reference to the component instance is returned by the initialization function:
```javascript
const inst = mobiscroll.eventcalendar('#my-div', { theme: 'ios' });
console.log('The Eventcalendar instance:', inst);
```
### Inside events
A reference to the component instance is available in every Mobiscroll event as the second argument of the event handler.
```javascript
mobiscroll.eventcalendar('#my-div', {
onEventCreate: (args, inst) => {
console.log('The Eventcalendar instance:', inst);
},
});
```
### The `getInst` method
A reference to the component instance is also returned by the `getInst` function:
```js
mobiscroll.eventcalendar('#my-div', { theme: 'ios' });
const inst = mobiscroll.getInst('#my-div');
console.log('The Eventcalendar instance:', inst);
```
The `getInst` function also receives a second parameter. When `true` is passed to the parameter the form control instance will be returned. This is usefull when two components are initialized on the same element, for example: a mobiscroll input and a datepicker.
```html
```
```js
mobiscroll.datepicker('#my-inp');
const instDatepicker = mobiscroll.getInst('#my-inp'); // the main component instance
const instInput = mobiscroll.getInst('#my-inp', true); // the form component instance
```
## Calling methods
All the component methods are documented on each components API section. The methods can be called on the component instances as described in the previous section.
#### Example: Getting invalid dates for a date range
One such a case when you might need to call an instance method would be to get the invalid data for a time period from the eventcalendar. Since the invalid data you pass to the Eventcalendar can contain recurring rules, you need a way to calculate the actual occurences. Luckily the Eventcalendar has a method that will return the actual occurences for a time period.
```javascript title="Invalid rule that repeats on specific days"
const invalidsArray = [
{
start: '2023-10-18',
allDay: true,
recurring: {
repeat: 'weekly',
weekDays: 'MO,FR,SA',
interval: 1
}
}
];
```
To get the actual invalid days for the month of November, you can call the [`getInvalids`](../eventcalendar/api#method-getInvalids) method of the Eventcalendar instance.
```javascript
// initialize the eventcalendar with the invalid rule
// and get the instance
const inst = mobiscroll.eventcalendar('#my-div', {
invalid: invalidsArray
});
// query the invalid occurences
const occurences = inst.getInvalids('2023-11-01', '2023-12-01');
```
The result in this case will be an array of objects, each of them being an occurence of an invalid day in November.
---
## Localization
## Overview
The Mobiscroll components offer comprehensive localization features, ensuring they can be seamlessly integrated into any project worldwide.
These features include:
- the ability to format dates and times according to regional preferences
- the components allow for the customization of button labels and other interface text, making it easy to translate these elements into any language
- support for right-to-left (RTL) text direction, which is essential for languages like Arabic and Hebrew
These localization capabilities ensure that Mobiscroll components provide a user-friendly and culturally appropriate experience for users across different regions and languages.
## Localization options for components
- [Date & time picker](/javascript/datepicker/api#localization)
- [Event Calendar](/javascript/eventcalendar/api#localization)
- [Select](/javascript/select/api#localization)
- [Popup](/javascript/popup/api#localization)
- Forms - check out the localization options under the different Form components - Localization section
- [Alert](/javascript/notifications/alert#localization)
- [Confirm](/javascript/notifications/confirm#localization)
- [Prompt](/javascript/notifications/prompt#localization)
- [Button](/javascript/forms/button#localization)
- [Checkbox](/javascript/forms/checkbox#localization)
- [Dropdown](/javascript/forms/dropdown#localization)
- [Input](/javascript/forms/input#localization)
- [Radio button](/javascript/forms/radio#localization)
- [Segmented](/javascript/forms/segmented#localization)
- [Stepper](/javascript/forms/stepper#localization)
- [Switch](/javascript/forms/switch#localization)
- [Textarea](/javascript/forms/textarea#localization)
## Localization options
Here is a comprehensive list of all the localization options for Mobiscroll components.
### allDayText
string
Text for all day events.
**Default value**: `'All-day'`
### amText
string
Text for AM.
**Default value**: `'am'`
### calendarSystem
MbscCalendarSystem
Specifies the calendar system to be used. Supported calendars:
- Gregorian - Gregorian calendar. This is the default calendar system.
- Jalali - Persian calendar. The Farsi language needs to be included to the package.
- Hijri - Hijri calendar. The Arabic language needs to be included to the package
**Default value**: `undefined`
### cancelText
string
Text for the button which cancels the dialog.
**Default value**: `'Cancel'`
### closeText
string
Text for the "Close" button.
**Default value**: `'Close'`
### dateFormat
string
The format for parsed and displayed dates:
- `M` - month of year (no leading zero)
- `MM` - month of year (two digit)
- `MMM` - month name short
- `MMMM` - month name long
- `D` - day of month (no leading zero)
- `DD` - day of month (two digit)
- `DDD` - day of week (short)
- `DDDD` - day of week (long)
- `YY` - year (two digit)
- `YYYY` - year (four digit)
- `'...'` - literal text
- `''` - single quote
- anything else - literal text
**Default value**: `'MM/DD/YYYY'`
### dateFormatFull
string
Human readable date format, used by screen readers to read out full dates.
Characters have the same meaning as in the [dateFormat](#localization-dateFormat) option.
**Default value**: `'DDDD, MMMM D, YYYY'`
### dateFormatLong
string
Long date format, used by the agenda view and timeline day headers.
Characters have the same meaning as in the [dateFormat](#localization-dateFormat) option.
**Default value**: `'D DDD MMM YYYY'`
### dateText
string
Specifies the accessibility label for the date wheel.
**Default value**: `'Date'`
### dateWheels
string
Display order and formatting for month/day/year wheels. Characters have the same meaning as in the
[dateFormat](#localization-dateFormat) option. The options also controls if a specific wheel should appear or not,
e.g. use `'MMMMYYYY'` to display month and year wheels only, `'MMDDD DDYYYY'` to display both day of week and date on the day wheel.
If not specified, the order of the wheels will be taken from the [dateFormat](#localization-dateFormat) option, and the
formatting will be defined by the [theme](#opt-theme).
To display the whole date on one wheel, the format of the date should be specified between `|` characters:
```js
dateWheels: '|DDD MMM D|' // Will produce 'Sun Sep 9'
```
**Default value**: `undefined`
### dayNames
Array
The list of long day names, starting from Sunday.
**Default value**: `['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']`
### dayNamesMin
Array
The list of minimal day names, starting from Sunday.
**Default value**: `['S', 'M', 'T', 'W', 'T', 'F', 'S']`
### dayNamesShort
Array
The list of abbreviated day names, starting from Sunday.
**Default value**: `['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']`
### daySuffix
string
Additional string to display after the day on the wheel.
**Default value**: `undefined`
### dayText
string
Specifies the accessibility label for the day wheel.
**Default value**: `'Day'`
### eventsText
string
Text for the events word (plural).
**Default value**: `'events'`
### eventText
string
Text for the event word.
**Default value**: `'event'`
### filterEmptyText
string
Text for the empty state of the Select. The Select will show this message,
when [filtering](#opt-filter) is turned on and there are no results for the searched text.
**Default value**: `'No results'`
### filterPlaceholderText
string
Placeholder text for the filter input, when [filtering](#opt-filter) is turned on.
**Default value**: `'Search'`
### firstDay
number
Set the first day of the week: Sunday is 0, Monday is 1, etc.
**Default value**: `0`
### groupText
string
Specifies the accessibility label for the group wheel, when present.
**Default value**: `'Group'`
### hourText
string
Specifies the accessibility label for the hour wheel.
**Default value**: `'Hour'`
### locale
[MbscLocale](#type-MbscLocale)
Sets the language of the component. The locale object contains all the translations for a given language.
The built in language modules are listed below. If a language is not listed, it can be provided as a
[custom language module](https://mobiscroll.com/docs/core-concepts/localization#language-modules).
Supported values:
- Arabic: `localeAr`, `'ar'`
- Bulgarian: `localeBg`, `'bg'`
- Catalan: `localeCa`, `'ca'`
- Czech: `localeCs`, `'cs'`
- Chinese: `localeZh`, `'zh'`
- Croatian: `localeHr`, `'hr'`
- Danish: `localeDa`, `'da'`
- Dutch: `localeNl`, `'nl'`
- English: `localeEn` or `undefined`, `'en'`
- English (UK): `localeEnGB`, `'en-GB'`
- Farsi: `localeFa`, `'fa'`
- German: `localeDe`, `'de'`
- Greek: `localeEl`, `'el'`
- Spanish: `localeEs`, `'es'`
- Finnish: `localeFi`, `'fi'`
- French: `localeFr`, `'fr'`
- Hebrew: `localeHe`, `'he'`
- Hindi: `localeHi`, `'hi'`
- Hungarian: `localeHu`, `'hu'`
- Italian: `localeIt`, `'it'`
- Japanese: `localeJa`, `'ja'`
- Korean: `localeKo`, `'ko'`
- Lithuanian: `localeLt`, `'lt'`
- Norwegian: `localeNo`, `'no'`
- Polish: `localePl`, `'pl'`
- Portuguese (Brazilian): `localePtBR`, `'pt-BR'`
- Portuguese (European): `localePtPT`, `'pt-PT'`
- Romanian: `localeRo`, `'ro'`
- Russian: `localeRu`, `'ru'`
- Russian (UA): `localeRuUA`, `'ru-UA'`
- Slovak: `localeSk`, `'sk'`
- Serbian: `localeSr`, `'sr'`
- Swedish: `localeSv`, `'sv'`
- Thai: `localeTh`, `'th'`
- Turkish: `localeTr`, `'tr'`
- Ukrainian: `localeUa`, `'ua'`
**Default value**: `undefined`
### minuteText
string
Specifies the accessibility label for the minute wheel.
**Default value**: `'Minute'`
### monthNames
Array
The list of full month names.
**Default value**: `['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']`
### monthNamesShort
Array
The list of abbreviated month names.
**Default value**: `['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']`
### monthSuffix
string
Additional string to display after the month on the wheel.
**Default value**: `undefined`
### monthText
string
Specifies the accessibility label for the month wheel.
**Default value**: `'Month'`
### moreEventsPluralText
string
Text for the "more" label on the calendar, when there's not enough space to display all the labels for the day,
and there are more than one extra labels.
The `{count}` inside the string will be replaced with the number of extra labels.
When not specified, the [moreEventsText](#localization-moreEventsText) option will be used for both plural and singular form.
**Default value**: `undefined`
### moreEventsText
string
Text for the "more" label on the calendar, when there's not enough space to display all the labels for the day.
The `{count}` inside the string will be replaced with the number of extra labels.
Use the [moreEventsPluralText](#localization-moreEventsPluralText) as well, if the plural form is different.
**Default value**: `'{count} more'`
### newEventText
string
Title for the newly created event with the [dragToCreate](#opt-dragToCreate) and the
[clickToCreate](#opt-clickToCreate) action.
**Default value**: `'New event'`
### nextPageText
string
Text for the next button in the calendar header, used as accessibility label.
**Default value**: `'Next page'`
### noEventsText
string
Text for empty event list.
**Default value**: `'No events'`
### okText
string
Text for the button which closes the dialog.
**Default value**: `'OK'`
### pmText
string
Text for PM.
**Default value**: `'pm'`
### prevPageText
string
Text for the previous button in the calendar header, used as accessibility label.
**Default value**: `'Previous page'`
### quarterText
string
Text for quarter numbers in the timeline header. The {count} inside the string will be replaced with the number of the current quarter.
**Default value**: `'Q {count}'`
### rangeEndHelp
string
When selecting a range, it specifies the placeholder text for the end value under the [end label](#opt-showRangeLabels).
**Default value**: `'Please select'`
### rangeEndLabel
string
When selecting a range, it specifies the text of the [end label](#opt-showRangeLabels).
**Default value**: `'End'`
### rangeStartHelp
string
When selecting a range, it specifies the placeholder text for the start value under the [start label](#opt-showRangeLabels).
**Default value**: `'Please select'`
### rangeStartLabel
string
When selecting a range, it specifies the text of the [start label](#opt-showRangeLabels).
**Default value**: `'Start'`
### rtl
boolean
Enables right-to-left display.
**Default value**: `false`
### secondText
string
Specifies the accessibility label for the second wheel.
**Default value**: `'Second'`
### selectedPluralText
string
Specifies the plural form of the amount of selected items according to the rules of particular language. The '{count}' substring will
be replaced with the number of selected items.
**Default value**: `'{count} selected'`
### selectedText
string
Specifies the amount of selected items according to the rules of particular language. The '{count}' substring will be replaced with
the number of selected items.
**Default value**: `'{count} selected'`
### setText
string
Text for the "Set" button.
**Default value**: `'Set'`
### timeFormat
string
The format for parsed and displayed times:
- `h` - 12 hour format (no leading zero)
- `hh` - 12 hour format (leading zero)
- `H` - 24 hour format (no leading zero)
- `HH` - 24 hour format (leading zero)
- `m` - minutes (no leading zero)
- `mm` - minutes (leading zero)
- `s` - seconds (no leading zero)
- `ss` - seconds (leading zero)
- `a` - lowercase am/pm
- `A` - uppercase AM/PM
- `'...'` - literal text
- `''` - single quote
- anything else - literal text
**Default value**: `'hh:mm A'`
### timeText
string
Specifies the accessibility label for the time wheel.
**Default value**: `'Time'`
### timeWheels
string
Display order and formatting of the time wheels. Characters have the same meaning as in the
[timeFormat](#localization-timeFormat) option.
If not specified, the order of the wheels will be taken from the [timeFormat](#localization-timeFormat) option,
and the formatting will be defined by the theme.
To display the whole time on one wheel, the format of the time should be specified between `|` characters:
```js
timeWheels: '|h:mm A|' // Will produce '9:12 AM'
```
**Default value**: `undefined`
### todayText
string
Text for the "Today" button.
**Default value**: `'Today'`
### weekText
string
Text for week numbers in the timeline header. The {count} inside the string will be replaced with the number of the current week.
**Default value**: `'Week {count}'`
### yearSuffix
string
Additional string to display after the year on the wheel.
**Default value**: `undefined`
### yearText
string
Specifies the accessibility label for the year wheel.
**Default value**: `'Year'`
## Language modules
We offer and support a number of translations for the Mobiscroll library. If you don't find the language you're looking for, no problem. It's easy to create a language module that you can use.
The `locale` option can be used to set the language of a component. It takes an object, that should contain the translations of the texts used in the component. The supported languages can be set directly from the mobiscroll bundle.
```javascript title='Locale option usage'
mobiscroll.eventcalendar('#myexample', {
locale: mobiscroll.localeDe
});
```
Creating your own locale object is simple as creating an object in JavaScript. For example, the Cancel button on many Mobiscroll components uses the `cancelText` property. If you want to provide a translation for it, the locale object would look like this:
```javascript title='Creating a locale object'
var myLocale = {
cancelText: 'Mégse'
}
mobiscroll.eventcalendar('#myexample', {
locale: myLocale
});
```
The exact properties for each component can be found [above](#localization-options-for-components).
For typescript environments, the `MbscLocale` type can also be used as the base type for the locale object.
```ts title='Example with types'
const myLocale: MbscLocale = {
setText: 'Ok',
cancelText: 'Mégse'
};
```
Here's a template to use for the locale object:
```javascript title='Template'
var myLocale = {
// Core
setText: 'OK',
cancelText: 'Mégse',
clearText: 'Törlés',
selectedText: '{count} kiválasztva',
// Datetime component
dateFormat: 'YYYY.MM.DD.',
dateFormatLong: 'YYYY. MMM. D., DDD',
dayNames: ['Vasárnap', 'Hétfő', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'],
dayNamesShort: ['Va', 'Hé', 'Ke', 'Sze', 'Csü', 'Pé', 'Szo'],
dayNamesMin: ['V', 'H', 'K', 'Sz', 'Cs', 'P', 'Sz'],
dayText: 'Nap',
delimiter: '.',
hourText: 'Óra',
minuteText: 'Perc',
monthNames: ['Január', 'Február', 'Március', 'Április', 'Május', 'Június', 'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'],
monthNamesShort: ['Jan', 'Feb', 'Már', 'Ápr', 'Máj', 'Jún', 'Júl', 'Aug', 'Szep', 'Okt', 'Nov', 'Dec'],
monthText: 'Hónap',
secText: 'Másodperc',
timeFormat: 'H:mm',
yearText: 'Év',
nowText: 'Most',
pmText: 'pm',
amText: 'am',
// Calendar component
firstDay: 1,
dateText: 'Dátum',
timeText: 'Idő',
todayText: 'Ma',
prevMonthText: 'Előző hónap',
nextMonthText: 'Következő hónap',
prevYearText: 'Előző év',
nextYearText: 'Következő év',
closeText: 'Bezár',
eventText: 'esemény',
eventsText: 'esemény',
allDayText: 'Egész nap',
noEventsText: 'Nincs esemény',
moreEventsText: '{count} további',
}
```
---
## Recurrence
Some of the Eventcalendar and Datepicker options support recurrence rules. Recurrence rules regulate if the particular option (event, label, mark, etc.) reoccures periodically.
For example the [data](../eventcalendar/api#opt-data), [colors](../eventcalendar/api#opt-colors), [labels](../eventcalendar/api#opt-labels), [marked](../eventcalendar/api#opt-labels), and [invalid](../eventcalendar/api#opt-invalid) options of the Eventcalendar or the [colors](../datepicker/api#opt-colors), [marked](../datepicker/api#opt-marked), [labels](../datepicker/api#opt-labels) and [invalid](../datepicker/api#opt-invalid) options of the Datepicker support recurrence rules through their `recurring` property. The rule can be an object or a string in `RRULE` format.
## Supported properties
When specifying the recurring rule **as an object**, the following properties are supported:
- `repeat`: *string* - The frequency of the recurrence. String equivalent: `FREQ`.
- `'daily'` - Daily repeat
- `'weekly'` - Weekly repeat
- `'monthly'` - Monthly repeat
- `'yearly'` - Yearly repeat
- `day`: *number | Array* - The day of the month in case of monthly and yearly repeat. String equivalent: `BYMONTHDAY`. Negative numbers are calculated from the end of the month, -1 meaning the last day of the month.
- `month`: *number | Array* - Specify the month in case of yearly repeat. String equivalent: `BYMONTH`.
- `weekDays`: *string* - Comma separated list of the week days ('SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA') for the occurrences. String equivalent: `BYDAY`.
- `weekStart`: *string* - Specifies the first day of the week ('SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'). Default is 'MO'. String equivalent: `WKST`.
- `pos`: *number* - Specifies the nth occurrence of the weekdays in a month in case of the monthly and yearly repeat. It also supports negative values in this case the order will be counted from the end of the month. This property depends on the repeat property. String equivalent: `BYSETPOS`.
- `count`: *number* - The number of occurrences. String equivalent: `COUNT`.
- `from`: *string | Date | object* - The start date of the occurrences. String equivalent: `DTSTART`.
- `until`: *string | Date | object* - The end date of the occurrences. String equivalent: `UNTIL`.
- `interval`: *number* - The time interval for the rule, e.g. every 3 days, or every 2 weeks. This depends on the repeat property. String equivalent: `INTERVAL`.
```javascript title="Rule specified as an object"
recurring: {
repeat: 'daily',
count: 5,
interval: 2
}
```
When specified **as a string**, the properties are separated by the `;` character.
```javascript title="Rule specified as a string"
recurring: 'FREQ=DAILY;COUNT=5;INTERVAL=2'
```
## Rule exceptions
In case you would like to skip some dates from your rule, that's when the recurring exception come in handy. You can either set specific dates and/or a recurring rule as an exception, using the `recurringException` and the `recurringExceptionRule` properties.
```javascript title="Excluding exact dates from a daily repeating event"
// repeats daily, every day
recurring: {
repeat: 'daily',
interval: 1
},
// except on these dates
recurringException: ['2023-07-10','2023-07-23','2023-07-28'],
```
The `recurringExceptionRule` property is usefull when there is a rule to the exception you want to enforce. For example, you want to exclude the first day of each month:
```javascript title="Excluding the first day of each month from a daily repeating event"
// repeats daily, every day
recurring: {
repeat: 'daily',
interval: 1
},
// except on the 1st day of each month:
recurringExceptionRule: {
repeat: 'monthly',
day: 1,
interval: 1
}
```
:::info
In case you drag & drop an event on the calendar which is an occurrence of a recurring event, a new event will be created for the moved or resized event and the occurrence date will be added as a recurring exception to the original recurring event.
:::
:::tip
There is a [recurring exception configurator demo](https://demo.mobiscroll.com/scheduler/recurring-events) that can be used to experiment with the rules. Check it out on the previous link!
:::
Full example
```html
```
```javascript title="Recurring events on the eventcalendar"
mobiscroll.eventcalendar('#my-div', {
data: [{
start: new Date(2020, 2, 18, 9, 0),
end: new Date(2020, 2, 18, 17, 0),
title: 'Repeat every 2 days 5 times',
recurring: {
repeat: 'daily',
count: 5,
interval: 2
}
}, {
start: new Date(2020, 2, 17, 20, 0),
end: new Date(2020, 2, 17, 22, 0),
title: 'Football training every Monday and Wednesday',
recurring: 'FREQ=WEEKLY;UNTIL=2020-06-17;BYDAY=MO,WE'
}, {
title: 'Pay the bills - on every first Friday of the months',
recurring: {
repeat: 'monthly',
pos: 1,
weekDays: 'FR',
}
}],
});
```
---
## Accessibility(Eventcalendar)
## Keyboard Support
The Eventcalendar supports different [views](./api#opt-view) for different jobs and each of these views support keyboard navigation.
Focus can be moved with the `Tab` key. Focusable elements depend on the displayed view (more details below).
Buttons can be triggered using the `Space` key when focused.
Rendered events act like buttons. When an event is focused, the [event click](./api#event-onEventClick) event can be triggered using the `Space` or `Enter` keys.
### Calendar view
Focusable elements are:
* the header buttons: navigation, prev, next and today buttons
* the events rendered on the calendar view
* the currently selected day
When the selected day is focused, the focus can be moved using the `Up`, `Down`, `Left` and `Right` arrow keys and set with the `Space` or `Enter` keys.
When the popover is enabled on events, it can be toggled using the `Space` and `Esc` keys.
### Agenda
Focusable elements are:
* the header buttons: navigation, prev, next and today buttons
* the currently selected day
* the events listed in the agenda
### Scheduler
Focusable elements are:
* the header buttons: navigation, prev, next and today buttons
* the events rendered in the scheduler
### Timeline
Focusable elements are:
* the header buttons: navigation, prev, next and today buttons
* the events rendered on the timeline
## WCAG 2.2
The [Web Content Accessibility Guidelines (WCAG)](https://www.w3.org/WAI/standards-guidelines/wcag/) provide guidelines developed by the World [Wide Web Consortium (W3C)](https://www.w3.org/) to ensure web content is accessible to people with disabilities. WCAG 2.2 establishes a framework of accessibility principles and their associated success criteria. The level of accessibility conformance achieved by a web application is determined by the extent to which it meets these success criteria, categorized into three levels: A, AA, and AAA.
While Mobiscroll components are not fully compliant with WCAG 2.2 at this time, we are committed to enhancing their accessibility. We are actively working on improving compliance and continuously making progress.
The guidelines and success criteria are organized around the following four principles:
### [1. Perceivable](https://www.w3.org/TR/WCAG22/#perceivable)
Information and user interface components must be presentable to users in ways they can perceive.
Guidelines
Level
Compatibility
Remarks
1.1 Text Alternatives
1.1.1 Non-text Content
A
Supported
aria-label on icon buttons, aria-hidden on decoration elements
1.2 Time-based Media
1.2.1 Audio-only and Video-only (Prerecorded)
A
Not Applicable
-
1.2.2 Captions (Prerecorded)
A
Not Applicable
-
1.2.3 Audio Description or Media Alternative (Prerecorded)
A
Not Applicable
-
1.2.4 Captions (Live)
AA
Not Applicable
-
1.2.5 Audio Description (Prerecorded)
AA
Not Applicable
-
1.2.6 Sign Language (Prerecorded)
AAA
Not Applicable
-
1.2.7 Extended Audio Description (Prerecorded)
AAA
Not Applicable
-
1.2.8 Media Alternative (Prerecorded)
AAA
Not Applicable
-
1.2.9 Audio-only (Live)
AAA
Not Applicable
-
1.3 Adaptable
1.3.1 Info and Relationships
A
Supported
-
1.3.2 Meaningful Sequence
A
Supported
-
1.3.3 Sensory Characteristics
A
Supported
-
1.3.4 Orientation
AA
Supported
responsiveness works with all orientations
1.3.5 Identify Input Purpose
AA
Not applicable
-
1.3.6 Identify Purpose
AAA
Supported
-
1.4 Distinguishable
1.4.1 Use of Color
A
Supported
-
1.4.2 Audio Control
A
Not Applicable
-
1.4.3 Contrast (Minimum)
AA
Not fully supported
by building a height contrast theme
1.4.4 Resize Text
AA
Supported
-
1.4.5 Images of Text
AA
Not Applicable
-
1.4.6 Contrast (Enhanced)
AAA
Not fully supported
by building a height contrast theme
1.4.7 Low or No Background Audio
AAA
Not Applicable
-
1.4.8 Visual Presentation
AAA
Supported
by building a custom theme or custom CSS
1.4.9 Images of Text (No Exception)
AAA
Not Applicable
-
1.4.10 Reflow
AA
Supported
in case of Scheduler and Timeline two dimensional scrolling could be necessary but these views are data tables
1.4.11 Non-text Contrast
AA
Supported
borders
1.4.12 Text Spacing
AA
Supported
can be modified with custom CSS
1.4.13 Content on Hover or Focus
AA
Supported
title attribute on event hover
### [2. Operable](https://www.w3.org/TR/WCAG22/#operable)
User interface components and navigation must be operable.
Guidelines
Level
Compatibility
Remarks
2.1 Keyboard Accessible
2.1.1 Keyboard
A
Supported
D&D works with mouse and touch control but keyboard alternatives can be implemented ex. add/edit popup
2.1.2 No Keyboard Trap
A
Supported
-
2.1.3 Keyboard (No Exception)
AAA
Supported
D&D works with mouse and touch control but keyboard alternatives can be implemented ex. add/edit popup. In case of the Scheduler and Timeline the onCellClick event is not fired when using the keyboard
2.1.4 Character Key Shortcuts
A
Not Applicable
-
2.2 Enough Time
2.2.1 Timing Adjustable
A
Not applicable
-
2.2.2 Pause, Stop, Hide
A
Not Applicable
-
2.2.3 No Timing
AAA
Supported
-
2.2.4 Interruptions
AAA
Not Applicable
-
2.2.5 Re-authenticating
AAA
Not Applicable
-
2.2.6 Timeouts
AAA
Not Applicable
-
2.3 Seizures and Physical Reactions
2.3.1 Three Flashes or Below Threshold
A
Supported
-
2.3.2 Three Flashes
AAA
Supported
-
2.3.3 Animation from Interactions
AAA
Not supported
Calendar view page change animation, all views navigation popup animation
2.4 Navigable
2.4.1 Bypass Blocks
A
Not Applicable
-
2.4.2 Page Titled
A
Not Applicable
-
2.4.3 Focus Order
A
Supported
-
2.4.4 Link Purpose (In Context)
A
Not Applicable
-
2.4.5 Multiple Ways
AA
Not Applicable
-
2.4.6 Headings and Labels
AA
Supported
event structure ex. title, time, etc.
2.4.7 Focus Visible
AA
Supported
-
2.4.8 Location
AAA
Not Applicable
-
2.4.9 Link Purpose (Link Only)
AAA
Not Applicable
-
2.4.10 Section Headings
AAA
Not Applicable
-
2.4.11 Focus Not Obscured (Minimum)
AA
Supported
-
2.4.12 Focus Not Obscured (Enhanced)
AAA
Supported
-
2.4.13 Focus Appearance
AAA
Not supported
-
2.5 Input Modalities
2.5.1 Pointer Gestures
A
Supported
-
2.5.2 Pointer Cancellation
A
Supported
-
2.5.3 Label in Name
A
Supported
-
2.5.4 Motion Actuation
A
Not Applicable
-
2.5.5 Target Size (Enhanced)
AAA
Not fully supported
exception the resize handle
2.5.6 Concurrent Input Mechanisms
AAA
Supported
-
2.5.7 Dragging Movements
AA
Supported
D&D works with mouse and touch control but keyboard alternatives can be implemented ex. add/edit popup
2.5.8 Target Size (Minimum)
AA
Not fully supported
exception the resize handle
### [3. Understandable](https://www.w3.org/TR/WCAG22/#understandable)
Information and the operation of user interface must be understandable.
Guidelines
Level
Compatibility
3.1 Readable
3.1.1 Language of Page
A
Not Applicable
3.1.2 Language of Parts
AA
Not Applicable
3.1.3 Unusual Words
AAA
Not Applicable
3.1.4 Abbreviations
AAA
Supported
3.1.5 Reading Level
AAA
Not Applicable
3.1.6 Pronunciation
AAA
Not Applicable
3.2 Predictable
3.2.1 On Focus
A
Supported
3.2.2 On Input
A
Not Applicable
3.2.3 Consistent Navigation
AA
Not Applicable
3.2.4 Consistent Identification
AA
Not Applicable
3.2.5 Change on Request
AAA
Not Applicable
3.2.6 Consistent Help
A
Not Applicable
3.3 Input Assistance
3.3.1 Error Identification
A
Not Applicable
3.3.2 Labels or Instructions
A
Not Applicable
3.3.3 Error Suggestion
AA
Not Applicable
3.3.4 Error Prevention (Legal, Financial, Data)
AA
Not Applicable
3.3.5 Help
AAA
Not Applicable
3.3.6 Error Prevention (All)
AAA
Not Applicable
3.3.7 Redundant Entry
A
Not Applicable
3.3.8 Accessible Authentication (Minimum)
AA
Not Applicable
3.3.9 Accessible Authentication (Enhanced)
AAA
Not Applicable
### [4. Robust](https://www.w3.org/TR/WCAG22/#robust)
Content must be robust enough that it can be interpreted reliably by a wide variety of user agents, including assistive technologies.
Guidelines
Level
Compatibility
4.1 Compatible
4.1.1 Parsing (Obsolete and removed)
-
-
4.1.2 Name, Role, Value
A
Supported
4.1.3 Status Messages
AA
Not Applicable
---
## Agenda
The [Agenda](https://demo.mobiscroll.com/agenda) displays a [list of events for a given period of time](https://demo.mobiscroll.com/agenda/daily-weekly-monthly-annual-agenda#) (year, month, week or day). It can be used as a [standalone component](https://demo.mobiscroll.com/agenda/full-event-customization#) or in [combination with the calendar](https://demo.mobiscroll.com/agenda/navigate-from-external-calendar#).
## Overview
The agenda supports a [configurable range listing](https://demo.mobiscroll.com/agenda/daily-weekly-monthly-annual-agenda#) along with daily, monthly and yearly presets.
The capabilities like [recurring events](/javascript/core-concepts/recurrence), [all-day, multi-day events](#opt-data), [responsiveness](#responsiveness) are supported by agenda.

## Showing the Agenda
### View combination
The four views - [scheduler](./scheduler), [calendar](./calendar), [timeline](./timeline), [agenda](./agenda) - can be used alone or combined with each-other to create the perfect user experience on mobile, desktop and on everything in-between.
For example, you can combine [a daily agenda with a weekly calendar](https://demo.mobiscroll.com/agenda/daily-agenda-with-week-calendar#) for listing the events for the selected day. The view option will look like the following:
```javascript title='Daily Agenda combined with Weekly Calendar'
mobiscroll.eventcalendar('#agenda', {
view: {
calendar: {
type: 'week'
},
agenda: {
type: 'day'
}
}
});
```
### Configuring the view
The Agenda view can be configured through the `view` option. Below are listed the `agenda` object properties which can help you fine-tune this view.
```javascript title='Example'
mobiscroll.eventcalendar('#agenda', {
view: {
agenda: {
type: 'day',
size: 2
}
}
});
```
### scrollable
boolean
When set to `true`, makes the event listing independently scrollable.
:::info
There 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 the `body` and `html` elements, 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
Display the day headers for every day in the list, even for those without events.
**Default value**: `false`
### size
number
Specifies the number of years, months, weeks or days included in the list (depending on the specified type).
**Default value**: `1`
### type
"day" | "month" | "year" | "week"
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 be `1`.
**Default value**: `'month'`
## Responsiveness
The agenda is [fully responsive](https://demo.mobiscroll.com/eventcalendar/responsive-month-view). It adapts to the available space and fills the screen to look good everywhere. While you don't have to worry about the width the height can be manually adjusted with the [height](#opt-height) option. This 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.
Use the [responsive](#opt-responsive) option to configure how the calendar behaves on different sized screens.
The responsive option is equipped with five breakpoints:
- `xsmall` (up to 575px),
- `small` (up to 767px),
- `medium` (up to 991px),
- `large` (up to 1199px),
- `xlarge` (from 1200px).
Also, custom breakpoints can be added if necessary:
- `my-custom-breakpoint: { breakpoint: 600 }` (from 600px up to the next breakpoint).
:::info
The available width is queried from the container element of the component and not the browsers viewport like in css media queries.
:::
```javascript title='Responsive configuration with the view option'
mobiscroll.eventcalendar('#agenda', {
responsive: {
xsmall: {
view: {
agenda: { type: 'week' }
}
},
medium: {
view: {
calendar: { type: 'week' },
agenda: { type: 'day' }
}
},
custom: { // Custom breakpoint, you can use multiple if needed, but each must have a unique name.
breakpoint: 1000,
view: {
calendar: { type: 'month' },
agenda: { type: 'month' }
}
}
}
});
```

## Templating
The display of Agenda can be customized with different [render functions](#renderers).
### The event
Customize the events that appear on the agenda with the [renderEvent](#renderer-renderEvent) option. It should return the markup of the event. The event calendar will take care of the positioning, but everything else (like background color, hover effect, etc.) is left to you.
Check out how you can style events in [this example](https://demo.mobiscroll.com/agenda/full-event-customization#) or just play with the slider below to see the differences.
### The event content
Customize the event content that appears on the agenda by using the [renderEventContent](#renderer-renderEventContent) option. The event calendar will take care of styling and you can focus on what you show inside of the event.
Check out how you can style event content in [this example](https://demo.mobiscroll.com/agenda/event-content-customization#) or just play with the slider below to see the differences.
### The agenda header
Customize how the header of the event calendar looks and how the components are arranged with the [renderHeader](#renderer-renderHeader) option. It takes a function that should return the desired markup. In the returned markup, you can use custom html as well as the built in header components of the calendar.
While fully customizing the header is very usefull, sometimes it's desireable to customize only parts of it. In this case you can take advantage of the default header's [building blocks](/javascript/eventcalendar/templating#header-templating). These components let you put toghether the header you want, while you don't have to worry about the functionality behind them.
Check out how you can style the header in [this example](https://demo.mobiscroll.com/agenda/customizing-header#) or just play with the slider below to see the differences.
### The agenda day header
Customize the day headers that appear on the agenda with the [renderDay](#renderer-renderDay) option. It should return the markup of the day header.
Check out how you can style the day headers in [this example](https://demo.mobiscroll.com/javascript/agenda/customizing-day-header#) or just play with the slider below to see the differences.
### The agenda empty state
Customize the look of the empty state through [renderAgendaEmpty](#renderer-renderAgendaEmpty) function. Give a more purposeful feedback to the user and optionally add further actions to it. The template can be totally custom or dynamic based on any criteria.
Check out how you can style the empty state in [this example](https://demo.mobiscroll.com/agenda/empty-state#) or just play with the slider below to see the differences.
## Event order
When rendering events, the following default order is applied:
- All-day events are placed at the top.
- Non-all-day events follow, sorted by their start times.
- Events with the same start time are ordered alphabetically by their titles.
To modify the default event order, you can use the `order` property of the [event data](#opt-data). If the order property does not meet your requirements, the [eventOrder](#opt-eventOrder) option can be used to further customize the ordering, which expects a function that compares two events and returns an order (-1 or 1).
## API
Here is a comprehensive list of all the specific options, events and methods of the Agenda view.
### Options
Explore the following API options that help you easily configure the Agenda.
### 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`
### 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](#type-MbscCalendarEvent)>
The events for the Eventcalendar.
The [`MbscCalendarEvent`](#type-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 event
- `cssClass`: *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 event
- `dragBetweenResources`: *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 event
- `id`: *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 the `eventOverlap`
property of the resource and the [eventOverlap](#opt-eventOverlap) option.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring events.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 the `eventResize` property of the resource and
the [dragToResize](#opt-dragToResize) option.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 event
- `textColor`: *string* - A color applied on the text.
- `timezone`: *string* - Timezone of the event
- `title`: *string* - The title of the event.
- `tooltip`: *string* - The tooltip text of the event.
:::info
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
:::
:::info
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
:::
:::info
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-onEventClick) event will receive the event object as argument, containing the custom properties as well.
:::
:::info
Use the [getEvents](#method-getEvents) method to get the events between two dates.
:::
```js
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.
:::info
When using timezones, the [exclusiveEndDates](#opt-exclusiveEndDates) option is also turned on by default.
:::
:::info
When using anything other than the default (`'local'`), a [timezone plugin](#opt-timezonePlugin)
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](https://gist.github.com/aviflax/a4093965be1cd008f172), e.g. `"America/New_York"`.
If not specified, it defaults to the [displayTimezone](#opt-displayTimezone).
**Default value**: `undefined`
### defaultSelectedDate
[MbscDateType](#type-MbscDateType)
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.
:::info
When using timezones, the [exclusiveEndDates](#opt-exclusiveEndDates) option is also turned on by default.
:::
:::info
When using anything other than the default (`'local'`), a [timezone plugin](#opt-timezonePlugin)
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](https://gist.github.com/aviflax/a4093965be1cd008f172), e.g. `"America/New_York"`.
**Default value**: `'local'`
### eventOrder
(event1: [MbscCalendarEvent](#type-MbscCalendarEvent), event2: [MbscCalendarEvent](#type-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`
### 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.
:::info
When using timezones, the `exclusiveEndDates` option will default to `true`.
:::
### 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`
### max
[MbscDateType](#type-MbscDateType)
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](#opt-invalid) option with daily recurrence starting from the specific date.
**Default value**: `undefined`
### min
[MbscDateType](#type-MbscDateType)
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](#opt-invalid) option with daily recurrence until the specific date.
**Default value**: `undefined`
### modules
Array
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.
```js
// import the print module
// later on, add it to the modules array:
modules: [print]
```
### refDate
[MbscDateType](#type-MbscDateType)
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](#opt-selectedDate) option.
**Default value**: `undefined`
### responsive
[MbscResponsiveOptions](#type-MbscResponsiveOptions)
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.
:::info
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: 0px
- `small` - min-width: 576px
- `medium` - min-width: 768px
- `large` - min-width: 992px
- `xlarge` - 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
[MbscDateType](#type-MbscDateType)
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](#opt-refDate) option.
You also need to pass a handler for the [onSelectedDateChange](#event-onSelectedDateChange) event
to update the selected date when the date is changed from the calendar.
**Default value**: `undefined`
### selectedEvents
Array<[MbscCalendarEvent](#type-MbscCalendarEvent)>
Specifies the selected events on the calendar. The [onSelectedEventsChange](#event-onSelectedEventsChange) event will be
fired when the selected events change from the calendar.
The [`MbscCalendarEvent`](#type-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 event
- `cssClass`: *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 event
- `dragBetweenResources`: *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 event
- `id`: *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 the `eventOverlap`
property of the resource and the [eventOverlap](#opt-eventOverlap) option.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring events.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 the `eventResize` property of the resource and
the [dragToResize](#opt-dragToResize) option.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 event
- `textColor`: *string* - A color applied on the text.
- `timezone`: *string* - Timezone of the event
- `title`: *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](#opt-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`
### 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](../theming/sass-variables) or
[create custom themes](../theming/sass-themes).
:::info
Make sure that the theme you set is included in the downloaded package.
:::
**Default value**: `undefined`
### themeVariant
"auto" | "light" | "dark"
Controls which variant of the [theme](#opt-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'` or `undefined` - 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
[MbscTimezonePlugin](#type-MbscTimezonePlugin)
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](https://momentjs.com/timezone/)
and [luxon](https://moment.github.io/luxon/#/).
You can specify either the [dataTimezone](#opt-dataTimezone) or the [displayTimezone](#opt-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-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* -
### width
string | number
Sets the width of the component.
**Default value**: `undefined`
### Events
The Agenda 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.
### onDestroy
(args: any, inst: any) => void
Triggered when the component is destroyed.
Parameters:
- args - The event argument object.
- inst - The component instance.
### onEventClick
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when an event is clicked.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was clicked.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the click.
- `event`: *MbscCalendarEvent* - The clicked calendar event.
- `resource`: *string | number* - The id of the resource where the event was clicked, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was clicked, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was clicked, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was clicked, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was clicked.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventDeleted
(args: MbscEventDeletedEvent, inst: EventcalendarBase) => void
Triggered when an event is deleted and it is removed from the view.
Parameters:
- args - The event argument with the following properties:
- `event`: *MbscCalendarEvent* - The deleted event.
- `events`: *Array* - The deleted events in case of multiple event selection.
- `source`: *'agenda' | 'calendar' | 'timeline' | 'schedule'* - The view where the event was deleted.
- inst - The component instance.
### onEventDoubleClick
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when an event is double-clicked.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was clicked.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the click.
- `event`: *MbscCalendarEvent* - The clicked calendar event.
- `resource`: *string | number* - The id of the resource where the event was clicked, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was clicked, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was clicker, if [slots](#opt-slots) are set.
- `slotObj`: *MbscResource* - The resource where the event was clicker, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was clicked.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventHoverIn
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer hovers an event on the calendar.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event is hovered.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the hover.
- `event`: *MbscCalendarEvent* - The hovered calendar event.
- `resource`: *string | number* - The id of the resource where the event is hovered, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event is hovered, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event is hovered, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event is hovered, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event is hovered.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventHoverOut
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer leaves an event on the calendar.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was hovered.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the hover.
- `event`: *MbscCalendarEvent* - The hovered calendar event.
- `resource`: *string | number* - The id of the resource where the event was hovered, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was hovered, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was hovered, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was hovered, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was hovered.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventRightClick
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when an event is right-clicked.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was clicked.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the click.
- `event`: *MbscCalendarEvent* - The clicked calendar event.
- `resource`: *string | number* - The id of the resource where the event was clicked, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was clicked, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was clicked, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was clicked, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was clicked.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onInit
(args: any, inst: any) => void
Triggered when the component is initialized.
Parameters:
- args - The event argument object.
- inst - The component instance.
### onPageChange
(args: MbscPageChangeEvent, inst: EventcalendarBase) => void
Triggered when the calendar page is changed (with buttons or swipe).
Parameters:
- args - The event argument with the following properties:
- `firstDay`: *Date* - The first day of the displayed page.
- `lastDay`: *Date* - The last day of the displayed page, as an exclusive end date, pointing to 00:00 of the next day.
- `month`: *Date* - The first day of the visible month in case of month view.
- inst - The component instance.
### onPageLoaded
(args: MbscPageLoadedEvent, inst: EventcalendarBase) => void
Triggered when the calendar page is changed (with buttons or swipe) and the view finished rendering.
Parameters:
- args - The event argument with the following properties:
- `firstDay`: *Date* - The first day of the displayed page.
- `lastDay`: *Date* - The last day of the displayed page, as an exclusive end date, pointing to 00:00 of the next day.
- `month`: *Date* - The first day of the visible month in case of month view.
- inst - The component instance.
### onPageLoading
(args: MbscPageLoadingEvent, inst: EventcalendarBase) => void
Triggered before the markup of a calendar page is starting to render.
Parameters:
- args - The event argument with the following properties:
- `firstDay`: *Date* - The first day of the displayed page.
- `lastDay`: *Date* - The last day of the displayed page, as an exclusive end date, pointing to 00:00 of the next day.
- `month`: *Date* - The first day of the visible month in case of month view.
- inst - The component instance.
### onSelectedDateChange
(args: MbscSelectedDateChangeEvent, inst: EventcalendarBase) => void
Triggered when the selected date is changed, e.g. by clicking on a day on a calendar view, or by using the navigation arrows.
You can use this event in conjunction with the [selectedDate](#opt-selectedDate) option
to customize where the Eventcalendar should navigate.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The newly selected date.
- inst - The component instance.
### onSelectedEventsChange
(args: MbscSelectedEventsChangeEvent, inst: EventcalendarBase) => void
Triggered when an event is selected or deselected on the UI,
when [multiple event selection](#opt-selectMultipleEvents) is enabled.
You can also select events programmatically using the [selectedEvents](#opt-selectedEvents) option.
Parameters:
- args - The event argument with the following properties:
- `events`: *Array* - The selected events.
- inst - The component instance.
### Localization
The Agenda is fully localized. This covers date and time format, button copy, rtl and more.
### allDayText
string
Text for all day events.
**Default value**: `'All-day'`
### amText
string
Text for AM.
**Default value**: `'am'`
### calendarSystem
MbscCalendarSystem
Specifies the calendar system to be used. Supported calendars:
- Gregorian - Gregorian calendar. This is the default calendar system.
- Jalali - Persian calendar. The Farsi language needs to be included to the package.
- Hijri - Hijri calendar. The Arabic language needs to be included to the package
**Default value**: `undefined`
### dateFormat
string
The format for parsed and displayed dates:
- `M` - month of year (no leading zero)
- `MM` - month of year (two digit)
- `MMM` - month name short
- `MMMM` - month name long
- `D` - day of month (no leading zero)
- `DD` - day of month (two digit)
- `DDD` - day of week (short)
- `DDDD` - day of week (long)
- `YY` - year (two digit)
- `YYYY` - year (four digit)
- `'...'` - literal text
- `''` - single quote
- anything else - literal text
**Default value**: `'MM/DD/YYYY'`
### dateFormatFull
string
Human readable date format, used by screen readers to read out full dates.
Characters have the same meaning as in the [dateFormat](#localization-dateFormat) option.
**Default value**: `'DDDD, MMMM D, YYYY'`
### dateFormatLong
string
Long date format, used by the agenda view and timeline day headers.
Characters have the same meaning as in the [dateFormat](#localization-dateFormat) option.
**Default value**: `'D DDD MMM YYYY'`
### dayNames
Array
The list of long day names, starting from Sunday.
**Default value**: `['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']`
### dayNamesMin
Array
The list of minimal day names, starting from Sunday.
**Default value**: `['S', 'M', 'T', 'W', 'T', 'F', 'S']`
### dayNamesShort
Array
The list of abbreviated day names, starting from Sunday.
**Default value**: `['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']`
### firstDay
number
Set the first day of the week: Sunday is 0, Monday is 1, etc.
**Default value**: `0`
### locale
[MbscLocale](#type-MbscLocale)
Sets the language of the component. The locale object contains all the translations for a given language.
The built in language modules are listed below. If a language is not listed, it can be provided as a
[custom language module](https://mobiscroll.com/docs/core-concepts/localization#language-modules).
Supported values:
- Arabic: `localeAr`, `'ar'`
- Bulgarian: `localeBg`, `'bg'`
- Catalan: `localeCa`, `'ca'`
- Czech: `localeCs`, `'cs'`
- Chinese: `localeZh`, `'zh'`
- Croatian: `localeHr`, `'hr'`
- Danish: `localeDa`, `'da'`
- Dutch: `localeNl`, `'nl'`
- English: `localeEn` or `undefined`, `'en'`
- English (UK): `localeEnGB`, `'en-GB'`
- Farsi: `localeFa`, `'fa'`
- German: `localeDe`, `'de'`
- Greek: `localeEl`, `'el'`
- Spanish: `localeEs`, `'es'`
- Finnish: `localeFi`, `'fi'`
- French: `localeFr`, `'fr'`
- Hebrew: `localeHe`, `'he'`
- Hindi: `localeHi`, `'hi'`
- Hungarian: `localeHu`, `'hu'`
- Italian: `localeIt`, `'it'`
- Japanese: `localeJa`, `'ja'`
- Korean: `localeKo`, `'ko'`
- Lithuanian: `localeLt`, `'lt'`
- Norwegian: `localeNo`, `'no'`
- Polish: `localePl`, `'pl'`
- Portuguese (Brazilian): `localePtBR`, `'pt-BR'`
- Portuguese (European): `localePtPT`, `'pt-PT'`
- Romanian: `localeRo`, `'ro'`
- Russian: `localeRu`, `'ru'`
- Russian (UA): `localeRuUA`, `'ru-UA'`
- Slovak: `localeSk`, `'sk'`
- Serbian: `localeSr`, `'sr'`
- Swedish: `localeSv`, `'sv'`
- Thai: `localeTh`, `'th'`
- Turkish: `localeTr`, `'tr'`
- Ukrainian: `localeUa`, `'ua'`
**Default value**: `undefined`
### monthNames
Array
The list of full month names.
**Default value**: `['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']`
### monthNamesShort
Array
The list of abbreviated month names.
**Default value**: `['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']`
### nextPageText
string
Text for the next button in the calendar header, used as accessibility label.
**Default value**: `'Next page'`
### noEventsText
string
Text for empty event list.
**Default value**: `'No events'`
### pmText
string
Text for PM.
**Default value**: `'pm'`
### prevPageText
string
Text for the previous button in the calendar header, used as accessibility label.
**Default value**: `'Previous page'`
### rtl
boolean
Enables right-to-left display.
**Default value**: `false`
### timeFormat
string
The format for parsed and displayed times:
- `h` - 12 hour format (no leading zero)
- `hh` - 12 hour format (leading zero)
- `H` - 24 hour format (no leading zero)
- `HH` - 24 hour format (leading zero)
- `m` - minutes (no leading zero)
- `mm` - minutes (leading zero)
- `s` - seconds (no leading zero)
- `ss` - seconds (leading zero)
- `a` - lowercase am/pm
- `A` - uppercase AM/PM
- `'...'` - literal text
- `''` - single quote
- anything else - literal text
**Default value**: `'hh:mm A'`
### todayText
string
Text for the "Today" button.
**Default value**: `'Today'`
### Renderers
The display of the Agenda can be customized with different render functions.
### renderAgenda
(events: Array, options: MbscEventcalendarOptions, dayRefs: { [key:number]: HTMLElement | null }) => any
Customize the agenda listing.
Available parameters:
- `events`: _Array_ - The events of the current view, grouped by day. A day object has the following properties:
- `date`: _string_ - The formatted date of the day.
- `events`: _Array_ - The list of events for the day. An event object has the following properties:
- `allDay`: _string_ - The localized all-day text in case of all day events.
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `lastDay`: _boolean_ - True if it's rendered on the last day of a multiple event.
- `original`: _MbscCalendarEvent_ - The original event object.
- `start`: _string_ - The formatted start time, if the event is not all day.
- `title`: _string_ - The title of the event.
- `timestamp`: _number_ - The timestamp of the day.
- `options`: _MbscEventcalendarOptions_ - The current options of the component.
- `dayRefs`: _{ [key: string]: HTMLElement | null }_ - An object holding the references
to the DOM elements of the days containing the event lists.
Needed for the scroll functionality: clicking on a calendar date scrolls to the date on the list as well,
and scrolling the list updates the selected date on the calendar.
**Default value**: `undefined`
### renderAgendaEmpty
() => any
Customize the agenda listing when the list is empty.
**Default value**: `undefined`
### renderDay
(args: MbscCalendarDayData) => any
Customize the day cells of the calendar view and the date header in case of scheduler and timeline views.
If you are looking to customize only the day cells content and don't want to bother with the styling of the event,
in case of calendar and scheduler views you can use the [renderDayContent](#renderer-renderDayContent) option.
The following day specific details are available:
- `date`: _Date_ - The date of the rendered day.
- `selected`: _boolean_ - True if the date is selected (in case of the calendar view).
- `events`: _Array_ - The list of events for the day.
- `resource`: _string | number_ - The id of the resource in case of the scheduler (week and month views)
when the events are grouped by resources.
- `isActive`: _boolean_ - True for the current day (in case of the timeline view).
**Default value**: `undefined`
### renderEvent
(data: MbscCalendarEventData) => any
Customize the events that appear on the agenda and the popover.
If you are looking to customize only the content (e.g. add custom elements) and don't want to bother with the styling of the event,
you can use the [renderEventContent](#renderer-renderEventContent) option.
Some of the event specific details are computed, but there is also a reference to the **original** event they come from.
The following event specific properties are available:
- `allDay`: _string_ - The localized all-day text in case of all day events.
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `lastDay`: _boolean_ - True if it's rendered on the last day of a multiple event.
- `original`: _MbscCalendarEvent_ - The original event object.
- `start`: _string_ - The formatted start time, if the event is not all day.
- `title`: _string_ - The title of the event.
**Default value**: `undefined`
### renderEventContent
(data: MbscCalendarEventData) => any
Customize the event content that appears on the agenda and the popover.
The Eventcalendar will take care of styling and you can focus on what you show inside of the event.
If you are looking to fully customize the event (e.g. add custom hover effects) you will need to use the
[renderEvent](#renderer-renderEvent) option.
Some of the event specific details are computed, but there is also a reference to the **original** event they come from.
The following event specific properties are available:
- `allDay`: _string_ - The localized all-day text in case of all day events.
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `lastDay`: _boolean_ - True if it's rendered on the last day of a multiple event.
- `original`: _MbscCalendarEvent_ - The original event object. Any custom property on the event can be accessed through this property.
- `start`: _string_ - The formatted start time, if the event is not all day.
- `title`: _string_ - The title of the event.
**Default value**: `undefined`
### renderHeader
() => any
Customize the header of the event calendar.
You can use custom markup and the built in header components of the calendar.
**Default value**: `undefined`
### Types
### MbscCalendarEvent
Interface
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 event
- `cssClass`: *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 event
- `dragBetweenResources`: *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 event
- `id`: *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 the `eventOverlap`
property of the resource and the [eventOverlap](#opt-eventOverlap) option.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring events.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 the `eventResize` property of the resource and
the [dragToResize](#opt-dragToResize) option.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 event
- `textColor`: *string* - A color applied on the text.
- `timezone`: *string* - Timezone of the event
- `title`: *string* - The title of the event.
- `tooltip`: *string* - The tooltip text of the event.
### MbscDateType
string | Date | object
### MbscLocale
Interface
Properties:
- `allDayText`: *string*
- `amText`: *string*
- `calendarSystem`: *MbscCalendarSystem*
- `cancelText`: *string*
- `clearText`: *string*
- `closeText`: *string*
- `dateFormat`: *string*
- `dateFormatFull`: *string*
- `dateFormatLong`: *string*
- `dateText`: *string*
- `dateWheelFormat`: *string*
- `dayNames`: *Array*
- `dayNamesMin`: *Array*
- `dayNamesShort`: *Array*
- `daySuffix`: *string*
- `dayText`: *string*
- `eventText`: *string*
- `eventsText`: *string*
- `filterEmptyText`: *string*
- `filterPlaceholderText`: *string*
- `firstDay`: *number*
- `fromText`: *string*
- `hourText`: *string*
- `minuteText`: *string*
- `monthNames`: *Array*
- `monthNamesShort`: *Array*
- `monthSuffix`: *string*
- `monthText`: *string*
- `moreEventsPluralText`: *string*
- `moreEventsText`: *string*
- `nextMonthText`: *string*
- `nextYearText`: *string*
- `noEventsText`: *string*
- `nowText`: *string*
- `pmText`: *string*
- `prevMonthText`: *string*
- `prevYearText`: *string*
- `rangeEndHelp`: *string*
- `rangeEndLabel`: *string*
- `rangeStartHelp`: *string*
- `rangeStartLabel`: *string*
- `rtl`: *boolean*
- `secondText`: *string*
- `selectedPluralText`: *string*
- `selectedText`: *string*
- `setText`: *string*
- `timeFormat`: *string*
- `timeText`: *string*
- `timeWheels`: *string*
- `toText`: *string*
- `todayText`: *string*
- `weekText`: *string*
- `yearSuffix`: *string*
- `yearText`: *string*
### MbscRecurrenceRule
Interface
Properties:
- `count`: *number*
- `day`: *number | Array*
- `from`: *[MbscDateType](#type-MbscDateType)*
- `interval`: *number*
- `month`: *number | Array*
- `pos`: *number*
- `repeat`: *"daily" | "weekly" | "monthly" | "yearly"*
- `until`: *[MbscDateType](#type-MbscDateType)*
- `weekDays`: *string*
- `weekStart`: *string*
### MbscResponsiveOptions
Interface
The `MbscResponsiveOptions` supports custom properties in the form:
```
[key:string]: MbscEventcalendarOptions & {breakpoint?: number}
```
The keys are the names of the breakpoints, and the values are objects containing the options for the given breakpoint.
The `breakpoint` property, when present, specifies the min-width in pixels. The options will take into effect from that width.
:::info
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: 0px
- `small` - min-width: 576px
- `medium` - min-width: 768px
- `large` - min-width: 992px
- `xlarge` - min-width: 1200px
### MbscTimezonePlugin
Interface
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*
---
## 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](#opt-dragToCreate) option.
Using the [extendDefaultEvent](#opt-extendDefaultEvent) option extra properties can be set for the created event.
The event deletion functionality can be overwritten using the [eventDelete](#opt-eventDelete) option.
**Default value**: `undefined`
### colors
Array<[MbscCalendarColor](#type-MbscCalendarColor)>
Specifies the color for certain dates or date ranges on the calendar.
The [`MbscCalendarColor`](#type-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 color
- `end`: *string | object | Date* - Specifies the end date/time of a date/time range for the color
- `highlight`: *string* - Highlight color of the day, can be any valid CSS color (`'red'`, `'#ff0000'`, `'rgb(255, 0, 0)'`, etc.).
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring days.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Exception rule of the recurring rule.
Useful when recurring dates need to be skipped from the rule.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 color
- `textColor`: *string* - A color applied on the text.
- `title`: *string* - A title that will be displayed on the item.
:::info
The colored range will be considered all-day if:
- the `allDay` property is explicitly set.
- the `start` / `end` properties are not specified, only the `date`.
:::
:::info
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
:::
:::info
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
:::
:::info
The colors can be combined with the [labels](#opt-labels) or [marked](#opt-marked) options.
:::
```js
[
{ 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](#type-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-MbscEventConnection) type has the following properties:
- `arrow`: *boolean | "from" | "to" | "bidirectional"* - Specifies where to display arrows
If `true`, 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 begin
- `to`: *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](#type-MbscCalendarEvent)>
The events for the Eventcalendar.
The [`MbscCalendarEvent`](#type-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 event
- `cssClass`: *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 event
- `dragBetweenResources`: *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 event
- `id`: *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 the `eventOverlap`
property of the resource and the [eventOverlap](#opt-eventOverlap) option.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring events.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 the `eventResize` property of the resource and
the [dragToResize](#opt-dragToResize) option.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 event
- `textColor`: *string* - A color applied on the text.
- `timezone`: *string* - Timezone of the event
- `title`: *string* - The title of the event.
- `tooltip`: *string* - The tooltip text of the event.
:::info
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
:::
:::info
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
:::
:::info
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-onEventClick) event will receive the event object as argument, containing the custom properties as well.
:::
:::info
Use the [getEvents](#method-getEvents) method to get the events between two dates.
:::
```js
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.
:::info
When using timezones, the [exclusiveEndDates](#opt-exclusiveEndDates) option is also turned on by default.
:::
:::info
When using anything other than the default (`'local'`), a [timezone plugin](#opt-timezonePlugin)
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](https://gist.github.com/aviflax/a4093965be1cd008f172), e.g. `"America/New_York"`.
If not specified, it defaults to the [displayTimezone](#opt-displayTimezone).
**Default value**: `undefined`
### defaultSelectedDate
[MbscDateType](#type-MbscDateType)
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.
:::info
When using timezones, the [exclusiveEndDates](#opt-exclusiveEndDates) option is also turned on by default.
:::
:::info
When using anything other than the default (`'local'`), a [timezone plugin](#opt-timezonePlugin)
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](https://gist.github.com/aviflax/a4093965be1cd008f172), 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](#opt-dragInTime) option.
Consider that [dragToMove](#opt-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](#opt-dragInTime) option.
Consider that [dragToMove](#opt-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](#opt-dragBetweenResources) option.
Consider that [dragToMove](#opt-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](#opt-newEventText) option.
Using the [extendDefaultEvent](#opt-extendDefaultEvent) option extra properties can be set for the created event.
The event deletion functionality can be overwritten using the [eventDelete](#opt-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](#opt-clickToCreate) and [dragToCreate](#opt-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](#type-MbscCalendarEvent), event2: [MbscCalendarEvent](#type-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.
:::info
When using timezones, the `exclusiveEndDates` option will default to `true`.
:::
### extendDefaultEvent
(args: MbscNewEventData) => void | [MbscCalendarEvent](#type-MbscCalendarEvent)
Use this option to set properties to the new event created with click or drag.
The event creation is handled by the [clickToCreate](#opt-clickToCreate) and [dragToCreate](#opt-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.
```js
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
"resource" | "date"
Groups the [events](#opt-data) by date or by [resource](#opt-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](#type-MbscDateType)> | Array<[MbscCalendarInvalid](#type-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* - 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* - Specifies the [resource](#opt-resources) 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](#opt-slots) 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.
:::info
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
:::
:::info
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
:::
```js
[
// 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-MbscCalendarInvalid) type has the following properties:
- `allDay`: *boolean* - If true the specified invalid will cover the whole day.
- `end`: *[MbscDateType](#type-MbscDateType)* - Specifies the end of the invalid range.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Recurrence rule for recurring invalid ranges.
- `recurringException`: *[MbscDateType](#type-MbscDateType) | Array<[MbscDateType](#type-MbscDateType)>* - Specifies recurring exceptions.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence exception rule.
Useful when recurring dates need to be skipped from the rule.
- `start`: *[MbscDateType](#type-MbscDateType)* - Specifies the start of the invalid range.
### invalidateEvent
"strict" | "start-end"
Specifies how to validate events against [invalid](#opt-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](#type-MbscCalendarLabel)>
Specifies labels for calendar days.
The [`MbscCalendarLabel`](#type-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 label
- `end`: *string | object | Date* - Specifies the end date/time of a date/time range for the label
- `order`: *number* - Specifies the order of the label in the array. Has precedence over the default ordering rules.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring days.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 label
- `textColor`: *string* - A color applied on the text.
- `title`: *string* - The title of the label.
- `tooltip`: *string* - Tooltip for the label
:::info
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
:::
:::info
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
:::
:::info
The labels can be combined with the [colors](#opt-colors) option.
:::
```js
[
{
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](#type-MbscCalendarMarked)>
Mark certain dates on the calendar. An array containing dates, or objects with the following properties:
The [`MbscCalendarMarked`](#type-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 applicable
- `end`: *string | object | Date* - Specifies the end date/time of a date/time range when this is applicable
- `markCssClass`: *string* - CSS class for the mark.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring days.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 applicable
- `textColor`: *string* - A color applied on the text.
- `title`: *string* - A title that will be displayed on the item.
:::info
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
:::
:::info
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
:::
:::info
The marked days can be combined with the [colors](#opt-colors) option.
:::
```js
[
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
[MbscDateType](#type-MbscDateType)
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](#opt-invalid) option with daily recurrence starting from the specific date.
**Default value**: `undefined`
### min
[MbscDateType](#type-MbscDateType)
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](#opt-invalid) option with daily recurrence until the specific date.
**Default value**: `undefined`
### modules
Array
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.
```js
// import the print module
// later on, add it to the modules array:
modules: [print]
```
### refDate
[MbscDateType](#type-MbscDateType)
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](#opt-selectedDate) option.
**Default value**: `undefined`
### resources
Array<[MbscResource](#type-MbscResource)>
The scheduler and timeline views can handle multiple resources.
Resource grouping can be modified with the help of the [groupBy](#opt-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-MbscResource) type has the following properties:
- `background`: *string* - Specifies the background color of the resource row or column.
- `children`: *Array<[MbscResource](#type-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](#opt-dragBetweenResources) option.
- `eventDragBetweenSlots`: *boolean* - Specifies whether the events in this slot are movable across slots.
Has precedence over the [dragBetweenSlots](#opt-dragBetweenSlots) option.
- `eventDragInTime`: *boolean* - Specifies whether the events in this resource are movable in time.
Has precedence over the [dragInTime](#opt-dragInTime) option.
- `eventOverlap`: *boolean* - Specifies whether the events in this resource can be overlapped.
Has precedence over the [eventOverlap](#opt-eventOverlap) option.
- `eventResize`: *boolean* - Specifies whether the events in this resource are resizable.
Has precedence over the [dragToResize](#opt-dragToResize) option.
- `fixed`: *boolean* - Specifies whether the resource is fixed to the top.
It applies for timeline view if `resolutionVertical` in [view](#opt-view) option is not given, or it's value is set to `none`.
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 if `resourceReorder` in [view](#opt-view) option is enabled.
```js
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](#type-MbscResponsiveOptions)
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.
:::info
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: 0px
- `small` - min-width: 576px
- `medium` - min-width: 768px
- `large` - min-width: 992px
- `xlarge` - 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
[MbscDateType](#type-MbscDateType)
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](#opt-refDate) option.
You also need to pass a handler for the [onSelectedDateChange](#event-onSelectedDateChange) event
to update the selected date when the date is changed from the calendar.
**Default value**: `undefined`
### selectedEvents
Array<[MbscCalendarEvent](#type-MbscCalendarEvent)>
Specifies the selected events on the calendar. The [onSelectedEventsChange](#event-onSelectedEventsChange) event will be
fired when the selected events change from the calendar.
The [`MbscCalendarEvent`](#type-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 event
- `cssClass`: *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 event
- `dragBetweenResources`: *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 event
- `id`: *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 the `eventOverlap`
property of the resource and the [eventOverlap](#opt-eventOverlap) option.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring events.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 the `eventResize` property of the resource and
the [dragToResize](#opt-dragToResize) option.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 event
- `textColor`: *string* - A color applied on the text.
- `timezone`: *string* - Timezone of the event
- `title`: *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](#opt-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
Array<[MbscSlot](#type-MbscSlot)>
The slots, besides the [resources](#opt-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-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.
```js
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](../theming/sass-variables) or
[create custom themes](../theming/sass-themes).
:::info
Make sure that the theme you set is included in the downloaded package.
:::
**Default value**: `undefined`
### themeVariant
"auto" | "light" | "dark"
Controls which variant of the [theme](#opt-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'` or `undefined` - 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
[MbscTimezonePlugin](#type-MbscTimezonePlugin)
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](https://momentjs.com/timezone/)
and [luxon](https://moment.github.io/luxon/#/).
You can specify either the [dataTimezone](#opt-dataTimezone) or the [displayTimezone](#opt-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-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
[MbscEventcalendarView](#type-MbscEventcalendarView)
Configures the Eventcalendar view. Possible views:
`calendar`: Configures the calendar view. Properties:
- `type`: *'week' | 'month' | 'year'* (default `'month'`) - Sets the calendar type.
- `size`: *number* (default `1`) - Specifies the number of displayed weeks or months.
- `count`: *boolean* (default `false`) - If `true`, 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.
- `outerDays`: *boolean* (default `false`) - Show or hide days from previous and next months. Does not apply to week view.
- `labels`: *boolean | number | 'all'* (default `true`) - 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](#opt-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.
- `popover`: *boolean* (default `undefined`) - 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* (default `undefined`) - 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* (default `false`) - 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 be `1`.
- `size`: *number* (default `1`) - Specifies the number of displayed years, months, weeks or days.
- `scrollable`: *boolean* (default `true`) - Setting this to `true` makes the agenda independently scrollable.
:::info
There 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 the `body` and `html` elements, 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* (default `false`) - When set to `true`, 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* (default `true`) - Show or hide the all day events.
- `currentTimeIndicator`: *boolean* (default `true`) - Show or hide the current time indicator.
- `days`: *boolean* (default `true`) - Show or hide week days above the scheduler grid.
- `startDay`: *number* (default `0`) - Specifies the first visible weekday of the view. Sunday is 0, Monday is 1, etc.
Days outside of the `startDay` and `endDay` range will not be visible.
Should not be mistaken for the [firstDay](#localization-firstDay) option,
which sets the first day of the week, and, if not set, is defined by the [localization](#localization-locale).
- `endDay`: *number* (default `6`) - 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* (default `false`) - Hide the empty columns in the scheduler view.
If set to `true`, the scheduler will not display columns without events.
- `hideInvalidColumns`: *boolean* (default `false`) - Hide the fully invalid columns in the scheduler view.
If set to `true`, 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 the `minEventWidth` view option and the actual column width.
- `minEventWidth`: *number* - Specifies the minimum event width. Will be used when `maxEventStack: 'auto'` is used.
- `timeCellStep`: *number* (default `60`) - 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* (default `60`) - 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* - 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](https://gist.github.com/aviflax/a4093965be1cd008f172).
If no label is provided, the time column label will be UTC +/- the timezone offset.
```js
timezones: ['Europe/Berlin','Europe/Bucharest']
```
```js
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 the `timeCellStep` and `timeLabelStep` properties.
- `currentTimeIndicator`: *boolean* - Show or hide the current time indicator.
Defaults to `true`, when the horizontal resolution is less than a day.
- `hideEmptyRows`: *boolean* (default `false`) - Hide the empty rows in the timeline view.
If set to `true`, the timeline will not display rows without events.
:::info
Parent resources will always be displayed, even when empty.
:::
- `hideInvalidRows`: *boolean* (default `false`) - Hide the fully invalid rows in the timeline view.
If set to `true`, the timeline will not display the fully invalid rows.
:::info
Parent resources will always be displayed, even when fully invalid.
:::
- `startDay`: *number* (default `0`) - Specifies the first visible weekday of the view. Sunday is 0, Monday is 1, etc.
Days outside of the `startDay` and `endDay` range will not be visible.
Should not be mistaken for the [firstDay](#localization-firstDay) option,
which sets the first day of the week, and, if not set, is defined by the [localization](#localization-locale).
- `endDay`: *number* (default `6`) - 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.
- `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* (default `60`) - 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* (default `60`) - 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.
:::info
[Learn more about variable event heights](./timeline#variable-event-height).
:::
- `eventList`: *boolean* (default `false`) - If `true`, 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* (default `true`) - Enable or disable virtual scroll.
- `weekNumbers`: *boolean* (default `false`) - Show or hide week numbers.
```js
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.
### onCellClick
(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* - The events for the clicked date.
- `resource`: *string | number* - The id of the resource where the cell was clicked, if [resources](#opt-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.
### onCellDoubleClick
(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* - The events for the clicked date.
- `resource`: *string | number* - The id of the resource where the cell was clicked, if [resources](#opt-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.
### onCellHoverIn
(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* - The colors for the hovered cell.
- `date`: *Date* - The date of the hovered day.
- `events`: *Array* - The events for the hovered cell.
- `invalids`: *Array* - The invalid dates for the hovered cell.
- `labels`: *Array* - If the cell has labels, contains the label objects for the hovered cell.
- `marked`: *Array* - 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.
### onCellHoverOut
(args: MbscCellHoverEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer leaves a day on the calendar view (does not apply for agenda view).
Parameters:
- args - The event argument with the following properties:
- `colors`: *Array* - The colors for the hovered cell.
- `date`: *Date* - The date of the hovered cell.
- `events`: *Array* - The events for the hovered cell.
- `invalids`: *Array* - The invalid dates for the hovered cell.
- `labels`: *Array* - If the cell has labels, contains the label objects for the hovered cell.
- `marked`: *Array* - 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.
### onCellRightClick
(args: MbscCellClickEvent, inst: EventcalendarBase) => void
Triggered when a cell is right-clicked on the calendar, scheduler, or timeline grid .
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* - The events for the clicked date.
- `resource`: *string | number* - The id of the resource where the cell was clicked, if [resources](#opt-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.
### onDestroy
(args: any, inst: any) => void
Triggered when the component is destroyed.
Parameters:
- args - The event argument object.
- inst - The component instance.
### onEventClick
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when an event is clicked.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was clicked.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the click.
- `event`: *MbscCalendarEvent* - The clicked calendar event.
- `resource`: *string | number* - The id of the resource where the event was clicked, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was clicked, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was clicked, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was clicked, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was clicked.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventCreate
(args: MbscEventCreateEvent, inst: EventcalendarBase) => void
Triggered when an event is about to create and it is not yet rendered on its final position.
Event creation can be prevented by returning `false` from the handler function.
Parameters:
- args - The event argument with the following properties:
- `action`: *'click' | 'drag' | 'externalDrop'* - The action which created the event.
- `domEvent`: *Event* - The DOM event from the end of the gesture (mouseup or touchend).
- `event`: *MbscCalendarEvent* - The newly created event.
- `originEvent`: *MbscCalendarEvent* - The occurrence of the event which was dragged.
Will be set only if the event was created by dragging a recurring event occurrence.
- `resourceObj`: *MbscResource* - The resource where the event is being created, if [resources](#opt-resources) are set.
- `slotObj`: *MbscSlot* - The slot where the event is being created, if [slots](#opt-slots) are set.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event is being created.
- inst - The component instance.
### onEventCreateFailed
(args: MbscEventCreateFailedEvent, inst: EventcalendarBase) => void
Triggered when an event creation failed due to overlapping an invalid range or another event.
Parameters:
- args - The event argument with the following properties:
- `action`: *'click' | 'drag' | 'externalDrop'* - The action which created the event.
- `event`: *MbscCalendarEvent* - The newly created event.
- `invalid`: *object* - The invalid object which the event overlapped.
- `overlap`: *MbscCalendarEvent* - The overlapped event.
- `originEvent`: *MbscCalendarEvent* - The occurrence of the event which was dragged.
Will be set only if the event was created by dragging a recurring event occurrence.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event was created.
- inst - The component instance.
### onEventCreated
(args: MbscEventCreatedEvent, inst: EventcalendarBase) => void
Triggered when an event is created and it is rendered in its position.
Parameters:
- args - The event argument with the following properties:
- `action`: *'click' | 'drag' | 'externalDrop'* - The action which created the event.
- `event`: *MbscCalendarEvent* - The newly created event.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event was created.
- `target`: *HTMLElement* - The DOM element of the created event.
- `resourceObj`: *MbscResource* - The resource where the event is being created, if [resources](#opt-resources) are set.
- `slotObj`: *MbscSlot* - The slot where the event is being created, if [slots](#opt-slots) are set.
- inst - The component instance.
### onEventDelete
(args: MbscEventDeleteEvent, inst: EventcalendarBase) => void
Triggered when an event is about to be deleted and it is not yet removed from the view.
Event deletion can be performed with delete and backspace button on an active event.
Deletion can be prevented by returning `false` from the handler function.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event from of the keydown action.
- `event`: *MbscCalendarEvent* - The event being deleted.
- `events`: *Array* - The events being deleted in case of multiple event selection.
- `source`: *'agenda' | 'calendar' | 'timeline' | 'schedule'* - The view where the event is being deleted.
- inst - The component instance.
### onEventDeleted
(args: MbscEventDeletedEvent, inst: EventcalendarBase) => void
Triggered when an event is deleted and it is removed from the view.
Parameters:
- args - The event argument with the following properties:
- `event`: *MbscCalendarEvent* - The deleted event.
- `events`: *Array* - The deleted events in case of multiple event selection.
- `source`: *'agenda' | 'calendar' | 'timeline' | 'schedule'* - The view where the event was deleted.
- inst - The component instance.
### onEventDoubleClick
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when an event is double-clicked.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was clicked.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the click.
- `event`: *MbscCalendarEvent* - The clicked calendar event.
- `resource`: *string | number* - The id of the resource where the event was clicked, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was clicked, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was clicker, if [slots](#opt-slots) are set.
- `slotObj`: *MbscResource* - The resource where the event was clicker, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was clicked.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventDragEnd
(args: MbscEventDragEvent, inst: EventcalendarBase) => void
Triggered when an event drag has ended.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the drag.
- `event`: *MbscCalendarEvent* - The dragged calendar event.
- `resource`: *string | number* - The id of the resource where the event was dragged, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was dragged, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was dragged, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was dragged, if [slots](#opt-slots) are set.
- `source`: *'calendar' | 'schedule' | 'timeline'* - The view where the event was dragged.
- inst - The component instance.
### onEventDragEnter
(args: MbscEventDragEvent) => void
Triggered when an event is dragged into the calendar/timeline/schedule view.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the drag.
- `event`: *MbscCalendarEvent* - The dragged calendar event.
- `source`: *'calendar' | 'schedule' | 'timeline'* - The view where the event is dragged.
### onEventDragLeave
(args: MbscEventDragEvent) => void
Triggered when an event is dragged out form the calendar/timeline/schedule view.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the drag.
- `event`: *MbscCalendarEvent* - The dragged calendar event.
- `source`: *'calendar' | 'schedule' | 'timeline'* - The view where the event is dragged.
### onEventDragStart
(args: MbscEventDragEvent, inst: EventcalendarBase) => void
Triggered when an event drag has started.
Parameters:
- args - The event argument with the following properties:
- `action`: *'create' | 'resize' | 'move'* - The user action which triggered the event.
- `domEvent`: *Event* - The DOM event of the drag.
- `event`: *MbscCalendarEvent* - The dragged calendar event.
- `resource`: *string | number* - The id of the resource where the event is dragged, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event is dragged, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event is dragged, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event is dragged, if [slots](#opt-slots) are set.
- `source`: *'calendar' | 'schedule' | 'timeline'* - The view where the event is dragged.
- inst - The component instance.
### onEventHoverIn
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer hovers an event on the calendar.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event is hovered.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the hover.
- `event`: *MbscCalendarEvent* - The hovered calendar event.
- `resource`: *string | number* - The id of the resource where the event is hovered, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event is hovered, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event is hovered, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event is hovered, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event is hovered.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventHoverOut
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer leaves an event on the calendar.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was hovered.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the hover.
- `event`: *MbscCalendarEvent* - The hovered calendar event.
- `resource`: *string | number* - The id of the resource where the event was hovered, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was hovered, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was hovered, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was hovered, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was hovered.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventRightClick
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when an event is right-clicked.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was clicked.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the click.
- `event`: *MbscCalendarEvent* - The clicked calendar event.
- `resource`: *string | number* - The id of the resource where the event was clicked, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was clicked, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was clicked, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was clicked, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was clicked.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventUpdate
(args: MbscEventUpdateEvent, inst: EventcalendarBase) => void
Triggered when an event is about to update. Update can be prevented by returning `false` from the handler function.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event from the end of the gesture (mouseup or touchend).
- `event`: *MbscCalendarEvent* - The updated event.
- `events`: *Array* - The updated events.
It is set on recurring event delete, when [multiple event selection](#opt-selectMultipleEvents) is enabled.
- `newEvent`: *MbscCalendarEvent* - The newly created event.
Will be set only if the dragged event was a recurring event occurrence.
- `oldEvent`: *MbscCalendarEvent* - The original event before the update.
- `oldEvents`: *Array* - The original events before the update.
It is set on recurring event delete, when [multiple event selection](#opt-selectMultipleEvents) is enabled.
- `oldEventOccurrence`: *MbscCalendarEvent* - The occurrence of the event which was dragged.
Will be set only if the dragged event was a recurring event occurrence.
- `oldResource`: number | string - The id of the resource from which the event was dragged.
- `oldResourceObj`: *MbscResource* - The resource from which the event was dragged.
- `oldSlot`: number | string - The id of the slot from which the event was dragged.
- `oldSlotObj`: *MbscSlot* - The slot from which the event was dragged.
- `resource`: number | string - The id of the resource where the event was dropped.
- `resourceObj`: *MbscResource* - The resource where the event was dropped.
- `slot`: number | string - The id of the slot where the event was dropped.
- `slotObj`: *MbscSlot* - The slot where the event was dropped.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event is being updated.
- inst - The component instance.
### onEventUpdateFailed
(args: MbscEventUpdateFailedEvent, inst: EventcalendarBase) => void
Triggered when an event update failed due to overlapping an invalid range or another event.
Parameters:
- args - The event argument with the following properties:
- `event`: *MbscCalendarEvent* - The updated event.
- `invalid`: *object* - The invalid object which the event overlapped.
- `overlap`: *MbscCalendarEvent* - The overlapped event.
- `newEvent`: *MbscCalendarEvent* - The newly created event.
Will be set only if the dragged event was a recurring event occurrence.
- `oldEvent`: *MbscCalendarEvent* - The original event before the update.
- `oldEventOccurrence`: *MbscCalendarEvent* - The occurrence of the event which was dragged.
Will be set only if the dragged event was a recurring event occurrence.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event was updated.
- inst - The component instance.
### onEventUpdated
(args: MbscEventUpdatedEvent, inst: EventcalendarBase) => void
Triggered when an event is updated and is rendered in its new position.
This is where you update the event in your database or persistent storage.
Parameters:
- args - The event argument with the following properties:
- `event`: *MbscCalendarEvent* - The updated event.
- `events`: *Array* - The updated events.
It is set on recurring event delete, when [multiple event selection](#opt-selectMultipleEvents) is enabled.
- `oldEvent`: *MbscCalendarEvent* - The original event before the update.
- `oldEvents`: *Array* - The original events before the update.
It is set on recurring event delete, when [multiple event selection](#opt-selectMultipleEvents) is enabled.
- `resourceObj`: *MbscResource* - The resource where the event is updated, if [resources](#opt-resources) are set.
- `slotObj`: *MbscSlot* - The slot where the event is updated, if [slots](#opt-slots) are set.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event was updated.
- `target`: *HTMLElement* - The DOM element of the updated event.
- inst - The component instance.
### onInit
(args: any, inst: any) => void
Triggered when the component is initialized.
Parameters:
- args - The event argument object.
- inst - The component instance.
### onLabelClick
(args: MbscLabelClickEvent, inst: EventcalendarBase) => void
Triggered when a label is clicked on the calendar.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date of the day on which the label was clicked.
- `domEvent`: *Event* - The DOM event of the click.
- `label`: *MbscCalendarLabel* - The original object of the label which was clicked, `undefined` in case of the "more" label.
- `labels`: *Array* - An array containing each label object for the given day.
- `target`: *HTMLElement* - The DOM element of the label.
- inst - The component instance.
### onPageChange
(args: MbscPageChangeEvent, inst: EventcalendarBase) => void
Triggered when the calendar page is changed (with buttons or swipe).
Parameters:
- args - The event argument with the following properties:
- `firstDay`: *Date* - The first day of the displayed page.
- `lastDay`: *Date* - The last day of the displayed page, as an exclusive end date, pointing to 00:00 of the next day.
- `month`: *Date* - The first day of the visible month in case of month view.
- inst - The component instance.
### onPageLoaded
(args: MbscPageLoadedEvent, inst: EventcalendarBase) => void
Triggered when the calendar page is changed (with buttons or swipe) and the view finished rendering.
Parameters:
- args - The event argument with the following properties:
- `firstDay`: *Date* - The first day of the displayed page.
- `lastDay`: *Date* - The last day of the displayed page, as an exclusive end date, pointing to 00:00 of the next day.
- `month`: *Date* - The first day of the visible month in case of month view.
- inst - The component instance.
### onPageLoading
(args: MbscPageLoadingEvent, inst: EventcalendarBase) => void
Triggered before the markup of a calendar page is starting to render.
Parameters:
- args - The event argument with the following properties:
- `firstDay`: *Date* - The first day of the displayed page.
- `lastDay`: *Date* - The last day of the displayed page, as an exclusive end date, pointing to 00:00 of the next day.
- `month`: *Date* - The first day of the visible month in case of month view.
- inst - The component instance.
### onResourceClick
(args: MbscResourceClickEvent, inst: EventcalendarBase) => void
Triggered when a resource cell is clicked on the scheduler or timeline.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date of the day on which the resource was clicked, when resources are grouped by day.
- `domEvent`: *Event* - The DOM event of the click.
- `resource`: *MbscResource* - The resource associated with the clicked cell.
- `source`: *'schedule' | 'timeline'* - The view where the cell was clicked.
- `target`: *HTMLElement* - The DOM element of the clicked cell.
- inst - The component instance.
### onResourceCollapse
(args: MbscResourceCollapseEvent, inst: EventcalendarBase) => void
Triggered when a parent resource is collapsed on the timeline.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the click.
- `resource`: *string | number* - The id of the collapsed [resource](#opt-resources).
- `resourceObj`: *MbscResource* - The collapsed [resource](#opt-resources).
- inst - The component instance.
### onResourceCreate
(args: MbscResourceCreateEvent, inst: EventcalendarBase) => void
Triggered when an resource is about to create and it is not yet rendered on its final position.
Resource creation can be prevented by returning `false` from the handler function.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event from the end of the gesture (mouseup or touchend).
- `index`: *number* - The position of the resource within its siblings.
- `parent`: *MbscResource* - The parent resource.
- `resource`: *MbscResource* - The newly created resource.
- inst - The component instance.
### onResourceCreated
(args: MbscResourceCreatedEvent, inst: EventcalendarBase) => void
Triggered when a resource is created and it is rendered in its position.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event from the end of the gesture (mouseup or touchend).
- `index`: *number* - The position of the resource within its siblings.
- `parent`: *MbscResource* - The parent resource.
- `resource`: *MbscResource* - The newly created resource.
- inst - The component instance.
### onResourceDelete
(args: MbscResourceDeleteEvent, inst: EventcalendarBase) => void
Triggered when an resource is about to be deleted and it is not yet removed from the view.
Resource deletion can be prevented by returning `false` from the handler function.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event from the end of the gesture (mouseup or touchend).
- `index`: *number* - The former position of the resource within its siblings.
- `parent`: *MbscResource* - The parent resource.
- `resource`: *MbscResource* - The resource being deleted.
- inst - The component instance.
### onResourceDeleted
(args: MbscResourceDeletedEvent, inst: EventcalendarBase) => void
Triggered when a resource is deleted and it is removed from the view.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event from the end of the gesture (mouseup or touchend).
- `index`: *number* - The former position of the resource within its siblings.
- `parent`: *MbscResource* - The parent resource.
- `resource`: *MbscResource* - The deleted resource.
- inst - The component instance.
### onResourceDoubleClick
(args: MbscResourceClickEvent, inst: EventcalendarBase) => void
Triggered when a resource cell is double-clicked on the scheduler or timeline.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date of the day on which the resource was clicked, when resources are grouped by day.
- `domEvent`: *Event* - The DOM event of the click.
- `resource`: *MbscResource* - The resource associated with the clicked cell.
- `source`: *'schedule' | 'timeline'* - The view where the cell was clicked.
- `target`: *HTMLElement* - The DOM element of the clicked cell.
- inst - The component instance.
### onResourceDragEnter
(args: MbscResourceDragEvent, inst: EventcalendarBase) => void
Triggered when a resource is dragged into the timeline view.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the drag.
- `resource`: *MbscResource* - The dragged resource.
- inst - The component instance.
### onResourceDragLeave
(args: MbscResourceDragEvent, inst: EventcalendarBase) => void
Triggered when a resource is dragged out from the timeline view.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the drag.
- `resource`: *MbscResource* - The dragged resource.
- inst - The component instance.
### onResourceExpand
(args: MbscResourceExpandEvent, inst: EventcalendarBase) => void
Triggered when a parent resource is expanded on the timeline.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the click.
- `resource`: *string | number* - The id of the expanded [resource](#opt-resources).
- `resourceObj`: *MbscResource* - The expanded [resource](#opt-resources).
- inst - The component instance.
### onResourceHoverIn
(args: MbscResourceHoverEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer hovers a resource cell on the timeline or scheduler view.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date of the hovered resource cell in case of group by date.
- `resource`: *MbscResource* - The hovered resource.
- `source`: *'schedule' | 'timeline'* - The view where the resource cell was hovered.
- `target`: *HTMLElement* - The DOM element of the resource cell.
- inst - The component instance.
### onResourceHoverOut
(args: MbscResourceHoverEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer leaves a resource cell on the timeline or scheduler view.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date of the hovered resource cell in case of group by date.
- `resource`: *MbscResource* - The hovered resource.
- `source`: *'schedule' | 'timeline'* - The view where the resource cell was hovered.
- `target`: *HTMLElement* - The DOM element of the resource cell.
- inst - The component instance.
### onResourceOrderUpdate
(args: MbscResourceOrderEvent, inst: EventcalendarBase) => void
Triggered after a resource is dragged and dropped into a new location.
Resource reorder can be prevented by returning `false` from the handler function.
It applies for timeline view if `resourceReorder` in [view](#opt-view) option is enabled.
Parameters:
- args - The event argument with the following properties:
- `index`: *Resource* - The new position of the resource within its siblings.
- `oldIndex`: *Resource* - The old position of the resource within its siblings.
- `oldParent`: *Resource* - The old parent resource.
- `parent`: *Resource* - The parent resource.
- `resource`: *Resource* - The updated resource.
- `resources`: Array<*Resource*> - The entire resources array with the new order.
- inst - The component instance.
### onResourceRightClick
(args: MbscResourceClickEvent, inst: EventcalendarBase) => void
Triggered when a resource cell is right-clicked on the scheduler or timeline.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date of the day on which the resource was clicked, when resources are grouped by day.
- `domEvent`: *Event* - The DOM event of the click.
- `resource`: *MbscResource* - The resource associated with the clicked cell.
- `source`: *'schedule' | 'timeline'* - The view where the cell was clicked.
- `target`: *HTMLElement* - The DOM element of the clicked cell.
- inst - The component instance.
### onSelectedDateChange
(args: MbscSelectedDateChangeEvent, inst: EventcalendarBase) => void
Triggered when the selected date is changed, e.g. by clicking on a day on a calendar view, or by using the navigation arrows.
You can use this event in conjunction with the [selectedDate](#opt-selectedDate) option
to customize where the Eventcalendar should navigate.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The newly selected date.
- inst - The component instance.
### onSelectedEventsChange
(args: MbscSelectedEventsChangeEvent, inst: EventcalendarBase) => void
Triggered when an event is selected or deselected on the UI,
when [multiple event selection](#opt-selectMultipleEvents) is enabled.
You can also select events programmatically using the [selectedEvents](#opt-selectedEvents) option.
Parameters:
- args - The event argument with the following properties:
- `events`: *Array* - The selected events.
- inst - The component instance.
### onVirtualLoading
(args: MbscVirtualLoadEvent, inst: EventcalendarBase) => void
Triggered when a new virtual page is loaded.
You can use this to load events and resources on demand while scrolling the timeline grid.
Parameters:
- args - The event argument with the following properties:
- `viewStart`: *Date* - The date where the virtual view starts.
- `viewEnd`: *Date* - The date where the virtual view end.
- `resourceStart`: *number|string* - The id of the resource where the virtual view starts.
- `resourceEnd`: *number|string* - The id of the resource where the virtual view ends.
- `oldResourceStart`: *number|string* - The id of the resource where the previous virtual view started.
- `oldResourceEnd`: *number|string* - The id of the resource where the previous virtual view ended.
- `oldViewStart`: *Date* - The date where the previous virtual view started.
- `oldViewEnd`: *Date*- The date where the previous virtual view ended.
- inst - The component instance.
## Localization
The Eventcalendar is fully localized. This covers date and time format, button copy, rtl and more.
### allDayText
string
Text for all day events.
**Default value**: `'All-day'`
### amText
string
Text for AM.
**Default value**: `'am'`
### calendarSystem
MbscCalendarSystem
Specifies the calendar system to be used. Supported calendars:
- Gregorian - Gregorian calendar. This is the default calendar system.
- Jalali - Persian calendar. The Farsi language needs to be included to the package.
- Hijri - Hijri calendar. The Arabic language needs to be included to the package
**Default value**: `undefined`
### dateFormat
string
The format for parsed and displayed dates:
- `M` - month of year (no leading zero)
- `MM` - month of year (two digit)
- `MMM` - month name short
- `MMMM` - month name long
- `D` - day of month (no leading zero)
- `DD` - day of month (two digit)
- `DDD` - day of week (short)
- `DDDD` - day of week (long)
- `YY` - year (two digit)
- `YYYY` - year (four digit)
- `'...'` - literal text
- `''` - single quote
- anything else - literal text
**Default value**: `'MM/DD/YYYY'`
### dateFormatFull
string
Human readable date format, used by screen readers to read out full dates.
Characters have the same meaning as in the [dateFormat](#localization-dateFormat) option.
**Default value**: `'DDDD, MMMM D, YYYY'`
### dateFormatLong
string
Long date format, used by the agenda view and timeline day headers.
Characters have the same meaning as in the [dateFormat](#localization-dateFormat) option.
**Default value**: `'D DDD MMM YYYY'`
### dayNames
Array
The list of long day names, starting from Sunday.
**Default value**: `['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']`
### dayNamesMin
Array
The list of minimal day names, starting from Sunday.
**Default value**: `['S', 'M', 'T', 'W', 'T', 'F', 'S']`
### dayNamesShort
Array
The list of abbreviated day names, starting from Sunday.
**Default value**: `['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']`
### eventText
string
Text for the event word.
**Default value**: `'event'`
### eventsText
string
Text for the events word (plural).
**Default value**: `'events'`
### firstDay
number
Set the first day of the week: Sunday is 0, Monday is 1, etc.
**Default value**: `0`
### locale
[MbscLocale](#type-MbscLocale)
Sets the language of the component. The locale object contains all the translations for a given language.
The built in language modules are listed below. If a language is not listed, it can be provided as a
[custom language module](https://mobiscroll.com/docs/core-concepts/localization#language-modules).
Supported values:
- Arabic: `localeAr`, `'ar'`
- Bulgarian: `localeBg`, `'bg'`
- Catalan: `localeCa`, `'ca'`
- Czech: `localeCs`, `'cs'`
- Chinese: `localeZh`, `'zh'`
- Croatian: `localeHr`, `'hr'`
- Danish: `localeDa`, `'da'`
- Dutch: `localeNl`, `'nl'`
- English: `localeEn` or `undefined`, `'en'`
- English (UK): `localeEnGB`, `'en-GB'`
- Farsi: `localeFa`, `'fa'`
- German: `localeDe`, `'de'`
- Greek: `localeEl`, `'el'`
- Spanish: `localeEs`, `'es'`
- Finnish: `localeFi`, `'fi'`
- French: `localeFr`, `'fr'`
- Hebrew: `localeHe`, `'he'`
- Hindi: `localeHi`, `'hi'`
- Hungarian: `localeHu`, `'hu'`
- Italian: `localeIt`, `'it'`
- Japanese: `localeJa`, `'ja'`
- Korean: `localeKo`, `'ko'`
- Lithuanian: `localeLt`, `'lt'`
- Norwegian: `localeNo`, `'no'`
- Polish: `localePl`, `'pl'`
- Portuguese (Brazilian): `localePtBR`, `'pt-BR'`
- Portuguese (European): `localePtPT`, `'pt-PT'`
- Romanian: `localeRo`, `'ro'`
- Russian: `localeRu`, `'ru'`
- Russian (UA): `localeRuUA`, `'ru-UA'`
- Slovak: `localeSk`, `'sk'`
- Serbian: `localeSr`, `'sr'`
- Swedish: `localeSv`, `'sv'`
- Thai: `localeTh`, `'th'`
- Turkish: `localeTr`, `'tr'`
- Ukrainian: `localeUa`, `'ua'`
**Default value**: `undefined`
### monthNames
Array
The list of full month names.
**Default value**: `['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']`
### monthNamesShort
Array
The list of abbreviated month names.
**Default value**: `['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']`
### moreEventsPluralText
string
Text for the "more" label on the calendar, when there's not enough space to display all the labels for the day,
and there are more than one extra labels.
The `{count}` inside the string will be replaced with the number of extra labels.
When not specified, the [moreEventsText](#localization-moreEventsText) option will be used for both plural and singular form.
**Default value**: `undefined`
### moreEventsText
string
Text for the "more" label on the calendar, when there's not enough space to display all the labels for the day.
The `{count}` inside the string will be replaced with the number of extra labels.
Use the [moreEventsPluralText](#localization-moreEventsPluralText) as well, if the plural form is different.
**Default value**: `'{count} more'`
### newEventText
string
Title for the newly created event with the [dragToCreate](#opt-dragToCreate) and the
[clickToCreate](#opt-clickToCreate) action.
**Default value**: `'New event'`
### nextPageText
string
Text for the next button in the calendar header, used as accessibility label.
**Default value**: `'Next page'`
### noEventsText
string
Text for empty event list.
**Default value**: `'No events'`
### pmText
string
Text for PM.
**Default value**: `'pm'`
### prevPageText
string
Text for the previous button in the calendar header, used as accessibility label.
**Default value**: `'Previous page'`
### quarterText
string
Text for quarter numbers in the timeline header. The {count} inside the string will be replaced with the number of the current quarter.
**Default value**: `'Q {count}'`
### rtl
boolean
Enables right-to-left display.
**Default value**: `false`
### timeFormat
string
The format for parsed and displayed times:
- `h` - 12 hour format (no leading zero)
- `hh` - 12 hour format (leading zero)
- `H` - 24 hour format (no leading zero)
- `HH` - 24 hour format (leading zero)
- `m` - minutes (no leading zero)
- `mm` - minutes (leading zero)
- `s` - seconds (no leading zero)
- `ss` - seconds (leading zero)
- `a` - lowercase am/pm
- `A` - uppercase AM/PM
- `'...'` - literal text
- `''` - single quote
- anything else - literal text
**Default value**: `'hh:mm A'`
### todayText
string
Text for the "Today" button.
**Default value**: `'Today'`
### weekText
string
Text for week numbers in the timeline header. The {count} inside the string will be replaced with the number of the current week.
**Default value**: `'Week {count}'`
## Methods
These methods are actions that can be performed on a component instance.
### addEvent
(events: [MbscCalendarEvent](#type-MbscCalendarEvent) | Array<[MbscCalendarEvent](#type-MbscCalendarEvent)>) => Array
Adds one or more events to the calendar
Parameters:
- events - Object or Array containing the events.
### getEvents
(start: [MbscDateType](#type-MbscDateType), end: [MbscDateType](#type-MbscDateType)) => Array<[MbscCalendarEvent](#type-MbscCalendarEvent)>
Returns the [events](#opt-data) between two dates. If `start` and `end` are not specified,
it defaults to the start and end days of the current view.
If `end` is not specified, it defaults to start date + 1 day.
Parameters:
- start - Start date of the specified interval.
- end - End date of the specified interval.
### getInvalids
(start: [MbscDateType](#type-MbscDateType), end: [MbscDateType](#type-MbscDateType)) => Array<[MbscCalendarEvent](#type-MbscCalendarEvent)>
Returns the [invalids](#opt-invalid) between two dates. If `start` and `end` are not specified,
it defaults to the start and end days of the current view.
If `end` is not specified, it defaults to start date + 1 day.
Parameters:
- start - Start date of the specified interval.
- end - End date of the specified interval.
### getSelectedEvents
() => Array<[MbscCalendarEvent](#type-MbscCalendarEvent)>
Returns the selected events.
### getViewDate
() => Date
Returns the view date which is representing the currently displayed date on the component.
### navigate
(date: [MbscDateType](#type-MbscDateType), animate: boolean) => void
Navigates to the specified 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.
To change the initial date of the calendar, use the [selectedDate](#opt-selectedDate) option instead.
Parameters:
- date - Date to navigate to.
### navigateToEvent
(event: [MbscCalendarEvent](#type-MbscCalendarEvent)) => void
Navigates to the specified event on the calendar.
Parameters:
- event - The event object. The `id`, `start` and `resource` properties (in case if resources
are used in timeline or schedule views) must be present in the object.
### removeEvent
(events: string | number | Array | Array | [MbscCalendarEvent](#type-MbscCalendarEvent) | Array<[MbscCalendarEvent](#type-MbscCalendarEvent)>) => void
Removes one or more events from the event list based on IDs. For events without IDs, the IDs are generated internally.
The generated ids are returned by the [addEvent](#method-addEvent) or [getEvents](#method-getEvents) methods.
Parameters:
- events - An array containing IDs or the event objects to be deleted.
### setEvents
(events: Array<[MbscCalendarEvent](#type-MbscCalendarEvent)>) => Array
Set the events for the calendar. The previous events will be overwritten.
Returns the list of IDs generated for the events.
Parameters:
- events - An array containing the events.
### setOptions
(opt: MbscEventcalendarOptions) => void
Sets or updates options of the component. Options can be updated dynamically after the initialization.
It receives an options object as parameter. Calling `setOptions` will overwrite all the options that
have a key in the options object parameter, and it will re-render the component.
```js
inst.setOptions({
themeVarian: 'dark',
})
```
### setSelectedEvents
(selectedEvents: Array<[MbscCalendarEvent](#type-MbscCalendarEvent)>) => void
Sets the selected events.
The selected events are returned by the [getSelectedEvents](#method-getSelectedEvents) method.
Multiple event selection can be turned on with the [selectMultipleEvents](#opt-selectMultipleEvents) option.
Parameters:
- selectedEvents - An array containing the selected event objects.
### updateEvent
(events: [MbscCalendarEvent](#type-MbscCalendarEvent) | Array<[MbscCalendarEvent](#type-MbscCalendarEvent)>) => void
Updates one or more events in the event calendar.
Parameters:
- events - The event or events to update.
## Renderers
The display of the Eventcalendar can be customized with different render functions.
### renderAgenda
(events: Array, options: MbscEventcalendarOptions, dayRefs: { [key:number]: HTMLElement | null }) => any
Customize the agenda listing.
Available parameters:
- `events`: _Array_ - The events of the current view, grouped by day. A day object has the following properties:
- `date`: _string_ - The formatted date of the day.
- `events`: _Array_ - The list of events for the day. An event object has the following properties:
- `allDay`: _string_ - The localized all-day text in case of all day events.
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `lastDay`: _boolean_ - True if it's rendered on the last day of a multiple event.
- `original`: _MbscCalendarEvent_ - The original event object.
- `start`: _string_ - The formatted start time, if the event is not all day.
- `title`: _string_ - The title of the event.
- `timestamp`: _number_ - The timestamp of the day.
- `options`: _MbscEventcalendarOptions_ - The current options of the component.
- `dayRefs`: _{ [key: string]: HTMLElement | null }_ - An object holding the references
to the DOM elements of the days containing the event lists.
Needed for the scroll functionality: clicking on a calendar date scrolls to the date on the list as well,
and scrolling the list updates the selected date on the calendar.
**Default value**: `undefined`
### renderAgendaEmpty
() => any
Customize the agenda listing when the list is empty.
**Default value**: `undefined`
### renderBufferAfter
(event: MbscCalendarEventData) => any
Customize the buffer area that is displayed at the end of the scheduler and timeline events.
The buffer can be defined with the help of the `bufferAfter` property of the [event data](#opt-data).
The template will receive an event object as data.
Some of the event specific details are computed, but there is also a reference to the **original** event they come from.
The following event specific properties are available:
- `allDay`: _string_ - The localized all-day text in case of all day events.
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `lastDay`: _boolean_ - True if it's rendered on the last day of a multiple event.
- `original`: _MbscCalendarEvent_ - The original event object.
- `start`: _string_ - The formatted start time, if the event is not all day.
- `title`: _string_ - The title of the event.
- `currentResource`: _string | number_ - The resource of the row or column where the event is being rendered.
**Default value**: `undefined`
### renderBufferBefore
(event: MbscCalendarEventData) => any
Customize the buffer area that is displayed at the start of the scheduler and timeline events.
The buffer can be defined with the help of the `bufferBefore` property of the [event data](#opt-data).
The template will receive an event object as data.
Some of the event specific details are computed, but there is also a reference to the **original** event they come from.
The following event specific properties are available:
- `allDay`: _string_ - The localized all-day text in case of all day events.
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `lastDay`: _boolean_ - True if it's rendered on the last day of a multiple event.
- `original`: _MbscCalendarEvent_ - The original event object.
- `start`: _string_ - The formatted start time, if the event is not all day.
- `title`: _string_ - The title of the event.
- `currentResource`: _string | number_ - The resource of the row or column where the event is being rendered.
**Default value**: `undefined`
### renderCell
(args: MbscCalendarCellData) => any
Customize the cells of the Eventcalendar in scheduler and timeline views.
The template will receive an object as context, which can be used to display custom content in the cells.
Keep the cell template simple, as it will be called and rendered **very frequently** during scroll and view changes.
The object passed to the template contains the following properties:
- `colors`: _Array_ - The list of colors for the current cell.
- `date`: _Date_ – The current cell's date.
- `events`: _Array_ - The list of events for the current cell.
- `invalids`: _Array_ - The list of invalids for the current cell.
- `resource`: _MbscResource_ – The resource object for the current cell.
- `slot`: _MbscSlot_ - The slot object for the current cell.
**Default value**: `undefined`
### renderDay
(args: MbscCalendarDayData) => any
Customize the day cells of the calendar view and the date header in case of scheduler and timeline views.
If you are looking to customize only the day cells content and don't want to bother with the styling of the event,
in case of calendar and scheduler views you can use the [renderDayContent](#renderer-renderDayContent) option.
The following day specific details are available:
- `date`: _Date_ - The date of the rendered day.
- `selected`: _boolean_ - True if the date is selected (in case of the calendar view).
- `events`: _Array_ - The list of events for the day.
- `resource`: _string | number_ - The id of the resource in case of the scheduler (week and month views)
when the events are grouped by resources.
- `isActive`: _boolean_ - True for the current day (in case of the timeline view).
**Default value**: `undefined`
### renderDayContent
(args: MbscCalendarDayData) => any
Customize the day cells content of the event calendar. The Eventcalendar will take care of the styling and you can focus on
what you show beside the day number.
If you are looking to fully customize the day (e.g. add custom hover effects) you will need to use the
[renderDay](#renderer-renderDay) option.
The following properties are available:
- `date`: _Date_ - The date of the rendered day.
- `selected`: _boolean_ - True if the date is selected (in case of the calendar view).
- `events`: _Array_ - The list of events for the day.
- `resource`: _string | number_ - The id of the resource in case of the scheduler (week and month views)
when the events are grouped by resources.
**Default value**: `undefined`
### renderDayFooter
(args: MbscCalendarDayData) => any
Customize the footer of each day for the timeline.
The following day specific details are available:
- `date`: _Date_ - The date of the day.
- `events`: _Array_ - The list of events for the day.
**Default value**: `undefined`
### renderEvent
(data: MbscCalendarEventData) => any
Customize the events that appear on the agenda and the popover.
If you are looking to customize only the content (e.g. add custom elements) and don't want to bother with the styling of the event,
you can use the [renderEventContent](#renderer-renderEventContent) option.
Some of the event specific details are computed, but there is also a reference to the **original** event they come from.
The following event specific properties are available:
- `allDay`: _string_ - The localized all-day text in case of all day events.
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `lastDay`: _boolean_ - True if it's rendered on the last day of a multiple event.
- `original`: _MbscCalendarEvent_ - The original event object.
- `start`: _string_ - The formatted start time, if the event is not all day.
- `title`: _string_ - The title of the event.
**Default value**: `undefined`
### renderEventContent
(data: MbscCalendarEventData) => any
Customize the event content that appears on the agenda and the popover.
The Eventcalendar will take care of styling and you can focus on what you show inside of the event.
If you are looking to fully customize the event (e.g. add custom hover effects) you will need to use the
[renderEvent](#renderer-renderEvent) option.
Some of the event specific details are computed, but there is also a reference to the **original** event they come from.
The following event specific properties are available:
- `allDay`: _string_ - The localized all-day text in case of all day events.
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `lastDay`: _boolean_ - True if it's rendered on the last day of a multiple event.
- `original`: _MbscCalendarEvent_ - The original event object. Any custom property on the event can be accessed through this property.
- `start`: _string_ - The formatted start time, if the event is not all day.
- `title`: _string_ - The title of the event.
**Default value**: `undefined`
### renderHeader
() => any
Customize the header of the event calendar.
You can use custom markup and the built in header components of the calendar.
**Default value**: `undefined`
### renderHour
(args: MbscCalendarDayData) => any
Customize the header of the hour columns on the timeline view.
The following properties are available:
- `date`: _Date_ - The date and time of the rendered hour.
- `events`: _Array_ - The list of events for the hour.
- `isActive`: _boolean_ - True for the current hour.
**Default value**: `undefined`
### renderHourFooter
(args: MbscCalendarDayData) => any
Customize the footer of the hour columns on the timeline view.
The following properties are available:
- `date`: _Date_ - The date and time of the rendered hour.
- `events`: _Array_ - The list of events for the hour.
- `isActive`: _boolean_ - True for the current hour.
**Default value**: `undefined`
### renderLabel
(event: MbscCalendarEventData) => any
Customize the labels that appear on the calendar view.
The Eventcalendar will take care of the positioning, but everything else (like background color, hover effect, etc.) is left to you.
If you are looking to customize only the content (e.g. add custom elements) and
don't want to bother with the styling of the label, you can use the [renderLabelContent](#renderer-renderLabelContent) option.
Some of the event specific details are computed, but there is also a reference to the **original** event they come from.
The following event specific properties are available:
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `original`: _MbscCalendarEvent_ - The original event object. Any custom property on the event can be accessed through this property.
- `start`: _string_ - The formatted start time, if the event is not all day.
**Default value**: `undefined`
### renderLabelContent
(event: MbscCalendarEventData) => any
Customize the label contents, that appears on the calendar.
The Eventcalendar will take care of styling and you can focus on what you show inside of the label.
If you are looking to fully customize the label (ex. add custom hover effects) you will need to use the
[renderLabel](#renderer-renderLabel) option.
In that case you will only get the positioning done by the Eventcalendar and everything else is up to you.
Some of the event specific details are computed, but there is also a reference to the **original** event they come from.
The following event specific properties are available:
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `original`: _MbscCalendarEvent_ - The original event object. Any custom property on the event can be accessed through this property.
- `start`: _string_ - The formatted start time, if the event is not all day.
**Default value**: `undefined`
### renderMonth
(args: MbscCalendarDayData) => any
Customize the header of the month column on the timeline view.
The following properties are available:
- `date`: _Date_ - First day of the rendered month.
- `events`: _Array_ - The list of events for the month.
- `isActive`: _boolean_ - True for the current month.
**Default value**: `undefined`
### renderMonthFooter
(args: MbscCalendarDayData) => any
Customize the footer of the month column on the timeline view.
The following properties are available:
- `date`: _Date_ - First day of the rendered month.
- `events`: _Array_ - The list of events for the month.
- `isActive`: _boolean_ - True for the current month.
**Default value**: `undefined`
### renderQuarter
(args: MbscCalendarDayData) => any
Customize the header of the quarter columns on the timeline view.
The following properties are available:
- `date`: _Date_ - First day of the rendered quarter.
- `events`: _Array_ - The list of events for the quarter.
- `isActive`: _boolean_ - True for the current quarter.
**Default value**: `undefined`
### renderQuarterFooter
(args: MbscCalendarDayData) => any
Customize the footer of the quarter column on the timeline view.
The following properties are available:
- `date`: _Date_ - First day of the rendered quarter.
- `events`: _Array_ - The list of events for the quarter.
- `isActive`: _boolean_ - True for the current quarter.
**Default value**: `undefined`
### renderResource
(resource: [MbscResource](#type-MbscResource), day: Date) => any
Customize how the resources are rendered on the scheduler and timeline views.
The following properties are available:
- `resource`: _MbscResource_ - The rendered resource.
- `day`: _Date_ - The date on which the resource is rendered.
Available when grouping by date in the scheduler view,
or when vertical day resolution is used in the timeline view.
**Default value**: `undefined`
### renderResourceEmpty
() => any
Customize the content of the resource column in case of an empty resource array.
**Default value**: `undefined`
### renderResourceFooter
() => any
Customize the cell content below the resource column on the timeline view,
when the [renderDayFooter](#renderer-renderDayFooter) option is also used.
**Default value**: `undefined`
### renderResourceHeader
() => any
Customize the cell content above the resource column on the timeline view.
**Default value**: `undefined`
### renderScheduleEvent
(event: MbscCalendarEventData) => any
Customize the events that appear on the scheduler and timeline.
The Eventcalendar will take care of the positioning,
but everything else (like background color, hover effect, etc.) is left to you.
If you are looking to customize only the content (e.g. add custom elements) and don't want to bother with the styling of the event,
you can use the [renderScheduleEventContent](#renderer-renderScheduleEventContent) option.
Some of the event specific details are computed, but there is also a reference to the **original** event they come from.
The following event specific properties are available:
- `allDay`: _string_ - The localized all-day text in case of all day events.
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `lastDay`: _boolean_ - True if it's rendered on the last day of a multiple event.
- `original`: _MbscCalendarEvent_ - The original event object.
- `start`: _string_ - The formatted start time, if the event is not all day.
- `title`: _string_ - The title of the event.
- `currentResource`: _string | number_ - The resource of the row or column where the event is being rendered.
**Default value**: `undefined`
### renderScheduleEventContent
(event: MbscCalendarEventData) => any
Customize the event content that appears on the scheduler and timeline.
The Eventcalendar will take care of styling and you can focus on what you show inside of the event.
If you are looking to fully customize the event (e.g. add custom hover effects) you will need to use
the [renderScheduleEvent](#renderer-renderScheduleEvent) option. In that case you will only get
the positioning done by the Eventcalendar and everything else is up to you.
Some of the event specific details are computed, but there is also a reference to the **original** event they come from.
The following event specific properties are available:
- `allDay`: _string_ - The localized all-day text in case of all day events.
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `lastDay`: _boolean_ - True if it's rendered on the last day of a multiple event.
- `original`: _MbscCalendarEvent_ - The original event object.
- `start`: _string_ - The formatted start time, if the event is not all day.
- `title`: _string_ - The title of the event.
- `currentResource`: _string | number_ - The resource of the row or column where the event is being rendered.
**Default value**: `undefined`
### renderSidebar
(resource: [MbscResource](#type-MbscResource)) => any
Add a custom sidebar on the right side of the timeline.
The object of the rendered resource is available for use.
**Default value**: `undefined`
### renderSidebarFooter
() => any
Customize the cell content below the sidebar column on the timeline view,
when the [renderSidebar](#renderer-renderSidebar) option is also used.
**Default value**: `undefined`
### renderSidebarHeader
() => any
Customize the cell content above the sidebar column on the timeline view,
when the [renderSidebar](#renderer-renderSidebar) option is also used.
**Default value**: `undefined`
### renderSlot
(args: MbscSlotData) => any
Customize the [slots](#opt-slots) template of the timeline view.
The following properties are available:
- `date`: _Date_ - The specific date where the slot is rendered.
- `slot`: _MbscSlot_ - The object of the rendered slot.
**Default value**: `undefined`
### renderWeek
(args: MbscCalendarDayData) => any
Customize the header of the week column on the timeline view.
The following properties are available:
- `date`: _Date_ - First day of the rendered week.
- `events`: _Array_ - The list of events for the week.
- `isActive`: _boolean_ - True for the current week.
- `endDate`: _Date_ - The end date of the week.
- `startDate`: _Date_ - The start date of the week.
- `weekNr`: _number_ - The week number. Enumeration starts with the first week of the year.
**Default value**: `undefined`
### renderWeekFooter
(args: MbscCalendarDayData) => any
Customize the footer of the week column on the timeline view.
The following properties are available:
- `date`: _Date_ - First day of the rendered week.
- `events`: _Array_ - The list of events for the week.
- `isActive`: _boolean_ - True for the current week.
- `endDate`: _Date_ - The end date of the week.
- `startDate`: _Date_ - The start date of the week.
- `weekNr`: _number_ - The week number. Enumeration starts with the first week of the year.
**Default value**: `undefined`
### renderYear
(args: MbscCalendarDayData) => any
Customize the header of the year column on the timeline view.
The following properties are available:
- `date`: _Date_ - First day of the rendered year.
- `events`: _Array_ - The list of events for the year.
- `isActive`: _boolean_ - True for the current year.
**Default value**: `undefined`
### renderYearFooter
(args: MbscCalendarDayData) => any
Customize the footer of the year column on the timeline view.
The following properties are available:
- `date`: _Date_ - First day of the rendered year.
- `events`: _Array_ - The list of events for the year.
- `isActive`: _boolean_ - True for the current year.
**Default value**: `undefined`
## Types
### MbscCalendarColor
Interface
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 color
- `end`: *string | object | Date* - Specifies the end date/time of a date/time range for the color
- `highlight`: *string* - Highlight color of the day, can be any valid CSS color (`'red'`, `'#ff0000'`, `'rgb(255, 0, 0)'`, etc.).
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring days.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Exception rule of the recurring rule.
Useful when recurring dates need to be skipped from the rule.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 color
- `textColor`: *string* - A color applied on the text.
- `title`: *string* - A title that will be displayed on the item.
### MbscCalendarEvent
Interface
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 event
- `cssClass`: *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 event
- `dragBetweenResources`: *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 event
- `id`: *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 the `eventOverlap`
property of the resource and the [eventOverlap](#opt-eventOverlap) option.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring events.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 the `eventResize` property of the resource and
the [dragToResize](#opt-dragToResize) option.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 event
- `textColor`: *string* - A color applied on the text.
- `timezone`: *string* - Timezone of the event
- `title`: *string* - The title of the event.
- `tooltip`: *string* - The tooltip text of the event.
### MbscCalendarInvalid
Interface
Properties:
- `allDay`: *boolean* - If true the specified invalid will cover the whole day.
- `end`: *[MbscDateType](#type-MbscDateType)* - Specifies the end of the invalid range.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Recurrence rule for recurring invalid ranges.
- `recurringException`: *[MbscDateType](#type-MbscDateType) | Array<[MbscDateType](#type-MbscDateType)>* - Specifies recurring exceptions.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence exception rule.
Useful when recurring dates need to be skipped from the rule.
- `start`: *[MbscDateType](#type-MbscDateType)* - Specifies the start of the invalid range.
### MbscCalendarLabel
Interface
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 label
- `end`: *string | object | Date* - Specifies the end date/time of a date/time range for the label
- `order`: *number* - Specifies the order of the label in the array. Has precedence over the default ordering rules.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring days.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 label
- `textColor`: *string* - A color applied on the text.
- `title`: *string* - The title of the label.
- `tooltip`: *string* - Tooltip for the label
### MbscCalendarMarked
Interface
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 applicable
- `end`: *string | object | Date* - Specifies the end date/time of a date/time range when this is applicable
- `markCssClass`: *string* - CSS class for the mark.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring days.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 applicable
- `textColor`: *string* - A color applied on the text.
- `title`: *string* - A title that will be displayed on the item.
### MbscDateType
string | Date | object
### MbscEventConnection
Interface
Properties:
- `arrow`: *boolean | "from" | "to" | "bidirectional"* - Specifies where to display arrows
If `true`, 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 begin
- `to`: *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.
### MbscEventcalendarView
Interface
Properties:
- `agenda`: *{scrollable?: boolean, showEmptyDays?: boolean, size?: number, type?: "day" | "month" | "year" | "week"}* - Configures the agenda view.
- `calendar`: *{count?: boolean, eventDisplay?: "fill" | "exact", labels?: number | boolean | "all", outerDays?: boolean, popover?: boolean, popoverClass?: string, scroll?: "horizontal" | "vertical", size?: number, type?: "month" | "year" | "week", weekNumbers?: boolean}* - Configures the calendar view.
- `schedule`: *{allDay?: boolean, currentTimeIndicator?: boolean, days?: boolean, endDay?: number, endTime?: string, hideEmptyColumns?: boolean, hideInvalidColumns?: boolean, maxEventStack?: number | "all" | "auto", minEventWidth?: number, size?: number, startDay?: number, startTime?: string, timeCellStep?: number, timeLabelStep?: number, timezones?: Array, type?: "day" | "month" | "week"}* - Configures the scheduler view.
- `timeline`: *{columnWidth?: MbscTimelineColumnWidth, currentTimeIndicator?: boolean, endDay?: number, endTime?: string, eventHeight?: "variable" | "equal", eventList?: boolean, hideEmptyRows?: boolean, hideInvalidRows?: boolean, maxEventStack?: number | "all", resolution?: "day" | "hour" | "month" | "year" | "week" | "quarter", resolutionHorizontal?: "day" | "hour" | "month" | "year" | "week" | "quarter", resolutionVertical?: "day", resourceReorder?: boolean, rowHeight?: "variable" | "equal", size?: number, startDay?: number, startTime?: string, timeCellStep?: number, timeLabelStep?: number, type?: "day" | "month" | "year" | "week", virtualScroll?: boolean, weekNumbers?: boolean, zoomLevels?: { [key:string]: MbscTimelineZoomLevel }}* - Configures the timeline view.
### MbscLocale
Interface
Properties:
- `allDayText`: *string*
- `amText`: *string*
- `calendarSystem`: *MbscCalendarSystem*
- `cancelText`: *string*
- `clearText`: *string*
- `closeText`: *string*
- `dateFormat`: *string*
- `dateFormatFull`: *string*
- `dateFormatLong`: *string*
- `dateText`: *string*
- `dateWheelFormat`: *string*
- `dayNames`: *Array*
- `dayNamesMin`: *Array*
- `dayNamesShort`: *Array*
- `daySuffix`: *string*
- `dayText`: *string*
- `eventText`: *string*
- `eventsText`: *string*
- `filterEmptyText`: *string*
- `filterPlaceholderText`: *string*
- `firstDay`: *number*
- `fromText`: *string*
- `hourText`: *string*
- `minuteText`: *string*
- `monthNames`: *Array*
- `monthNamesShort`: *Array*
- `monthSuffix`: *string*
- `monthText`: *string*
- `moreEventsPluralText`: *string*
- `moreEventsText`: *string*
- `nextMonthText`: *string*
- `nextYearText`: *string*
- `noEventsText`: *string*
- `nowText`: *string*
- `pmText`: *string*
- `prevMonthText`: *string*
- `prevYearText`: *string*
- `rangeEndHelp`: *string*
- `rangeEndLabel`: *string*
- `rangeStartHelp`: *string*
- `rangeStartLabel`: *string*
- `rtl`: *boolean*
- `secondText`: *string*
- `selectedPluralText`: *string*
- `selectedText`: *string*
- `setText`: *string*
- `timeFormat`: *string*
- `timeText`: *string*
- `timeWheels`: *string*
- `toText`: *string*
- `todayText`: *string*
- `weekText`: *string*
- `yearSuffix`: *string*
- `yearText`: *string*
### MbscRecurrenceRule
Interface
Properties:
- `count`: *number*
- `day`: *number | Array*
- `from`: *[MbscDateType](#type-MbscDateType)*
- `interval`: *number*
- `month`: *number | Array*
- `pos`: *number*
- `repeat`: *"daily" | "weekly" | "monthly" | "yearly"*
- `until`: *[MbscDateType](#type-MbscDateType)*
- `weekDays`: *string*
- `weekStart`: *string*
### MbscResource
Interface
Properties:
- `background`: *string* - Specifies the background color of the resource row or column.
- `children`: *Array<[MbscResource](#type-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](#opt-dragBetweenResources) option.
- `eventDragBetweenSlots`: *boolean* - Specifies whether the events in this slot are movable across slots.
Has precedence over the [dragBetweenSlots](#opt-dragBetweenSlots) option.
- `eventDragInTime`: *boolean* - Specifies whether the events in this resource are movable in time.
Has precedence over the [dragInTime](#opt-dragInTime) option.
- `eventOverlap`: *boolean* - Specifies whether the events in this resource can be overlapped.
Has precedence over the [eventOverlap](#opt-eventOverlap) option.
- `eventResize`: *boolean* - Specifies whether the events in this resource are resizable.
Has precedence over the [dragToResize](#opt-dragToResize) option.
- `fixed`: *boolean* - Specifies whether the resource is fixed to the top.
It applies for timeline view if `resolutionVertical` in [view](#opt-view) option is not given, or it's value is set to `none`.
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 if `resourceReorder` in [view](#opt-view) option is enabled.
The `MbscResource` supports custom properties in the form:
```
[x:string]: any
```
### MbscResponsiveOptions
Interface
The `MbscResponsiveOptions` supports custom properties in the form:
```
[key:string]: MbscEventcalendarOptions & {breakpoint?: number}
```
The keys are the names of the breakpoints, and the values are objects containing the options for the given breakpoint.
The `breakpoint` property, when present, specifies the min-width in pixels. The options will take into effect from that width.
:::info
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: 0px
- `small` - min-width: 576px
- `medium` - min-width: 768px
- `large` - min-width: 992px
- `xlarge` - min-width: 1200px
### MbscSlot
Interface
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.
The `MbscSlot` supports custom properties in the form:
```
[x:string]: any
```
### MbscTimezonePlugin
Interface
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*
---
## Blocked out dates
You can show blocked out time ranges with the [`invalid`](./api#opt-invalid) option. By default the events and the blocked out dates will be displayed on the view even if there is collision.
The [`invalid`](./api#opt-invalid) option supports the following formats: JavaScript Date objects, ISO8601 strings or moment object. These formats can be passed directly to the array in which case the whole day will be disabled or as an object where the blocked out ranges can be customized with the following properties: `allDay`, `start`, `end`, `title`, `recurring`.
Custom properties can also be passed to the invalid object which will also be passed to the life-cycle events and this can help with the identification/validation of the invalids.
If an event interacts with an invalid range the event will be reverted to it's original position and the [`onEventUpdateFailed`](./api#event-onEventUpdateFailed) event will be fired. (If the [`dragToMove`](./api#opt-dragToMove) or the [`dragToResize`](./api#opt-dragToResize) options were used.)
If a newly created event collides with a blocked out date the event won't be created and the [`onEventCreateFailed`](./api#event-onEventCreateFailed) event will be fired. (If the [`dragToCreate`](./api#opt-dragToCreate) option was used)
```javascript title="Invalid array example with various properties"
const invalid = [
/* Passing exact dates will block out the entire day */
new Date(2021, 1, 7), // Date object
'2021-10-15T12:00', // string
moment("2020-12-25"), // moment object
/* Block out date range passed as an object */
{
// multi day range with date string
start: '2021-10-15T12:00',
end: '2021-10-18T13:00',
title: 'Company 10th anniversary',
type: 'day-off' // custom property
},
{
// multi day range with date object
allDay: true,
start: new Date(2021, 2, 7, 10, 10),
end: new Date(2021, 2, 9, 20, 20),
title: 'Conference for the whole team',
type: 'conference' // custom property
},
{
// multi day time range with recurring and time string
start: '13:00',
end: '12:00',
recurring: { repeat: 'weekly', weekDays: 'MO,TU,WE,TH,FR' },
title: 'Lunch break',
type: 'lunch' // custom property
}
];
```

---
## Third party calendar integration
## Overview
The Calendar Integration is an optional plugin, that includes synchronization with your Google and Outlook calendar services. It can be installed and used with the Mobiscroll Event Calendar as described below.
:::info
Currently, the calendar integration plugins cannot be used in Chrome extensions, because the CSP rules do not allow loading scripts from 3rd party domains.
:::
## Installing the Calendar Integration Plugin
When your Mobiscroll package is created with the [Download Builder](https://download.mobiscroll.com) and you have access to the Calendar Integration, you can choose to include it in the built package. In this case you will need to make sure you checked the Calendar Integration before downloading the package from the download page. After installing your downloaded package, the Calendar Integration will be available for import.
When you're using the full Mobiscroll package from NPM, then you have the possibility to install the Calendar Integration as an additional package (also from NPM). In this case, after successfully using the [Mobiscroll CLI](https://docs.mobiscroll.com/cli) to configure the project, you will have to install the `@mobiscroll/calendar-integration` package from npm. Use the following command:
```bash
npm install @mobiscroll/calendar-integration
```
## Google calendar integration
The Google Calendar Integration is a part of the third party calendar integrations plugin that manages the synchronization with your Google calendar services.
### Public google calendars
The public google calendar integration allows you to load events from a public calendar without user authentication.
Calling the `init` function will do the necessary initializations for the third party. After the init, you can list the events from the public calendar.
```js
const calInst = mobiscroll.eventcalendar('#myDiv'. {
view: { schedule: { type: 'week' }},
});
// init google client
googleCalendarSync.init({
apiKey: 'YOUR_API_KEY',
onInit: () => {
googleCalendarSync.getEvents(
'PUBLIC_CALENDAR_ID',
new Date(2022, 1, 1),
new Date(2022, 3, 0)
).then((events) => {
calInst.setEvents(events);
});
},
});
```
:::info
The public google calendar integration only supports reading events.
Writing, updating, or deleting events requires the private calendar integration described below.
:::
### Private google calendars
The private google calendar integration allows your app to connect with google calendar services for reading and managing events.
Once initialized, users can sign in with their google account, view their calendars and events, and create, update, or delete events based on their granted permissions.
### Key details
- **User presence required**
The user must be in front of the computer and logged in for synchronization to happen. Sync is handled through client-side code.
- **User-driven updates**
Calendar syncing takes place when the user is logged in and interacting with the application. This approach gives users full control over when and how their data is synchronized.
- **Active session required**
To update or fetch events, the user needs to be logged in and have the application open. This means that changes made while the user is active — such as adding, editing, or deleting events — will be reflected in their connected calendar.
- **Server-side actions**
Server-generated events or background updates won't automatically appear in the connected calendar. To sync those changes, the user must be signed in and running the client-side integration.
### Login and sync flow
Follow these steps to set up and use the calendar integration correctly:
1. **User initiates sign-in**
Start the sign-in process from the browser using the Mobiscroll Calendar Integration SDK.
2. **User authenticates and grants permissions**
The user logs in and accepts the requested calendar permissions.
3. **Connection established**
Once authenticated, Mobiscroll can read and write events between your app and the connected calendar — as long as the user is active in the browser.
4. **Sync while the user is active**
Event synchronization happens only while the user is logged in and the client-side code is running.
5. **Next sync also requires presence**
Each new synchronization (for example, when fetching updated events or pushing new ones) requires the user to be logged in and active in the app.
Calling the `init` function will do the necessary initializations for the third party. For this step you need to use an API key and a client ID. After the `init`, you can sign in, list your calendars and events and create, update or delete the events on the calendars you have permission to.
```js
const calInst = mobiscroll.eventcalendar('#myDiv'. {
view: { schedule: { type: 'week' }},
});
// init google client
googleCalendarSync.init({
apiKey: 'YOUR_API_KEY',
clientId: 'YOUR_CLIENT_ID',
onSignedIn: () => {
googleCalendarSync.getEvents(
['MY_FIRST_CALENDAR_ID', 'MY_SECOND_CALENDAR_ID'],
new Date(2022, 1, 1),
new Date(2022, 3, 0)
).then((events) => {
calInst.setEvents(events);
});
},
onSignedOut: () => {
calInst.setEvents([]);
},
});
```
### Server side tokens
By default the authentication happens entirely on the client side. However, since the introduction of the new [Google Identity Services](https://developers.google.com/identity/gsi/web), the received access token, which ensures access to the user's calendars, is only valid for an hour. After expiry, the user will be prompted again for consent.
You can refresh an access token without prompting the user for permission, but this needs to be done server side. To enable this, in the init config object set the auth option to `'server'`, and specify the `authUrl` and `refreshUrl` pointing to your server endpoints.
The `authUrl` endpoint will receive a POST request, containing a unique authorization code. To exchange an authorization code for an access token, send a POST request to the https://oauth2.googleapis.com/token endpoint and set the following parameters:
* `client_id` - The client ID obtained from the Google API Console Credentials page.
* `client_secret` - The client secret obtained from the Google API Console Credentials page.
* `code` - The received authorization code.
* `grant_type` - This field's value must be set to `authorization_code`.
* `redirect_uri` - This field's value must be set to `postmessage`.
``` title="A sample request"
POST /token HTTP/1.1
Host: oauth2.googleapis.com
Content-Type: application/x-www-form-urlencoded
code=4/P7q7W91a-oMsCeLvIaQm6bTrgtp7&
client_id=your_client_id&
client_secret=your_client_secret&
redirect_uri=postmessage&
grant_type=authorization_code
```
``` title="A sample response"
{
"access_token": "1/fFAGRNJru1FTz70BzhT3Zg",
"expires_in": 3599,
"token_type": "Bearer",
"scope": "https://www.googleapis.com/auth/calendar.events.public.readonly https://www.googleapis.com/auth/calendar.readonly https://www.googleapis.com/auth/calendar.events.owned",
"refresh_token": "1//xEoDL4iW3cxlI7yDbSRFYNG01kVKM2C-259HOF2aQbI"
}
```
Return the received response from the request.
The `refreshUrl` endpoint will also receive a POST request, containing the refresh token, received earlier. To refresh an access token, send a POST request to the https://oauth2.googleapis.com/token endpoint and set the following parameters:
* `client_id` - The client ID obtained from the Google API Console Credentials page.
* `client_secret` - The client secret obtained from the Google API Console Credentials page.
* `refresh_token` - The received refresh token.
* `grant_type` - This field's value must be set to `refresh_token`.
``` title="A sample request"
POST /token HTTP/1.1
Host: oauth2.googleapis.com
Content-Type: application/x-www-form-urlencoded
client_id=your_client_id&
client_secret=your_client_secret&
refresh_token=your_refresh_token&
grant_type=refresh_token
```
``` title="A sample response"
{
"access_token": "1/fFAGRNJru1FTz70BzhT3Zg",
"expires_in": 3599,
"token_type": "Bearer",
"scope": "https://www.googleapis.com/auth/calendar.events.public.readonly https://www.googleapis.com/auth/calendar.readonly https://www.googleapis.com/auth/calendar.events.owned"
}
```
Return the received response from the request.
#### Complete example
A complete example with Node.js, ASP.NET and PHP
**Node.js**
```js
// Client
googleCalendarSync.init({
auth: 'server',
authUrl: 'http://example.com/auth',
clientId: 'YOUR_CLIENT_ID',
refreshUrl: 'http://example.com/refresh',
});
// Server
const http = require('http');
const https = require('https');
const YOUR_CLIENT_ID = 'YOUR_CLIENT_ID';
const YOUR_CLIENT_SECRET = 'YOUR_CLIENT_SECRET';
function getToken(type, codeOrToken, callback) {
const postData =
'client_id=' + YOUR_CLIENT_ID + '&' +
'client_secret=' + YOUR_CLIENT_SECRET + '&' +
(type === 'refresh' ?
'grant_type=refresh_token&' +
'refresh_token=' + codeOrToken
:
'grant_type=authorization_code&' +
'code=' + codeOrToken + '&' +
'redirect_uri=postmessage&' +
'code_verifier='
)
const postOptions = {
host: 'oauth2.googleapis.com',
port: '443',
path: '/token',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(postData)
}
};
const postReq = https.request(postOptions, function (response) {
response.setEncoding('utf8');
response.on('data', d => {
callback(d);
});
});
postReq.on('error', (error) => {
console.log(error)
});
// Post the request with data
postReq.write(postData);
postReq.end();
}
function getPostData(req, callback) {
let body = '';
req.on('data', (data) => {
body += data;
});
req.on('end', () => {
const parsed = new URLSearchParams(body);
const data = {}
for (const pair of parsed.entries()) {
data[pair[0]] = pair[1];
}
callback(data);
});
}
function checkCSRF(req, res) {
// Check if CSRF header is present
if (req.headers['x-requested-with'] === 'XmlHttpRequest') {
return true;
}
// Otherwise end the request
res.statusCode = 500;
res.end();
return false;
}
function sendResponse(res, data) {
// Set the headers in case of CORS request
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With');
// Send data
res.end(data);
}
const server = http.createServer(function (req, res) {
if (req.method === 'OPTIONS') { // Handle preflight request (in case of CORS request)
res.setHeader('Access-Control-Allow-Origin', '*'); // Use your own domain instead of the '*'
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With');
res.end();
} else if (req.url.startsWith('/auth')) { // Handle auth
if (checkCSRF(req, res)) {
getPostData(req, (data) => {
// Exchange auth code to access token (on sign in)
getToken('auth', data.code, (token) => {
sendResponse(res, token);
});
});
}
} else if (req.url.startsWith('/refresh')) { // Handle refresh
if (checkCSRF(req, res)) {
getPostData(req, (data) => {
// Exchange refresh token to access token (on access token expiry)
getToken('refresh', data.refresh_token, (token) => {
sendResponse(res, token);
});
});
}
}
});
server.listen(8080);
```
**ASP.NET**
```csharp
class HttpServer
{
public static HttpListener listener;
public static string url = "http://localhost:8080/";
private static readonly HttpClient client = new HttpClient();
public static Dictionary GetKeyValuePairs(string data)
{
return data.Split('&')
.Select(value => value.Split('='))
.ToDictionary(pair => pair[0], pair => pair[1]);
}
public static void SendResponse(HttpListenerRequest request, HttpListenerResponse resp, string type)
{
if (!request.HasEntityBody)
{
resp.Close();
}
Stream body = request.InputStream;
StreamReader reader = new StreamReader(body, request.ContentEncoding);
string codeOrToken = type == "auth" ? GetKeyValuePairs(reader.ReadToEnd())["code"] : GetKeyValuePairs(reader.ReadToEnd())["refresh_token"];
string postData = "client_id=" + YOUR_CLIENT_ID + "&" +
"client_secret=" + YOUR_CLIENT_SECRET + "&" +
(type == "refresh" ?
"grant_type=refresh_token&" +
"refresh_token=" + codeOrToken
:
"grant_type=authorization_code&" +
"code=" + codeOrToken + "&" +
"redirect_uri=postmessage&" +
"code_verifier=");
// Set the headers in case of CORS request
resp.AppendHeader("Access-Control-Allow-Origin", "*");
resp.AppendHeader("Access-Control-Allow-Headers", "X-Requested-With");
// Post the request with data
FormUrlEncodedContent content = new FormUrlEncodedContent(GetKeyValuePairs(postData));
HttpResponseMessage response = client.PostAsync("https://oauth2.googleapis.com/token", content).Result;
if (response.IsSuccessStatusCode)
{
HttpContent responseContent = response.Content;
string responseString = responseContent.ReadAsStringAsync().Result;
byte[] buffer = Encoding.UTF8.GetBytes(responseString);
// Get a response stream and write the response to it
resp.ContentLength64 = buffer.Length;
Stream output = resp.OutputStream;
output.Write(buffer, 0, buffer.Length);
output.Close();
}
else
{
Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase);
}
resp.Close();
}
public static bool CheckCSRF(HttpListenerRequest req, HttpListenerResponse resp)
{
// Check if CSRF header is present
if (req.Headers["x-requested-with"] == "XmlHttpRequest")
{
return true;
}
// Otherwise end the request
resp.StatusCode = 500;
resp.Close();
return false;
}
public static async Task HandleIncomingConnections()
{
bool runServer = true;
// Handling requests
while (runServer)
{
HttpListenerContext ctx = await listener.GetContextAsync();
HttpListenerRequest req = ctx.Request;
HttpListenerResponse resp = ctx.Response;
if (req.HttpMethod == "OPTIONS")
{ // Handle preflight request (in case of CORS request)
resp.AppendHeader("Access-Control-Allow-Origin", "*"); // Use your own domain instead of the '*'
resp.AppendHeader("Access-Control-Allow-Headers", "X-Requested-With");
resp.Close();
}
else if (req.Url.ToString().Contains("/auth"))
{ // Handle auth
if (CheckCSRF(req, resp))
{
SendResponse(req, resp, "auth");
}
}
else if (req.Url.ToString().Contains("/refresh"))
{ // Handle refresh
if (CheckCSRF(req, resp))
{
SendResponse(req, resp, "refresh");
}
}
}
}
public static void Main()
{
// Create a Http server and start listening for incoming connections
listener = new HttpListener();
listener.Prefixes.Add("http://localhost:8080/");
listener.Start();
// Handle requests
Task listenTask = HandleIncomingConnections();
listenTask.GetAwaiter().GetResult();
// Close the listener
listener.Close();
}
}
```
**PHP**
```php
function checkCSRF()
{
// Check if CSRF header is present
if ($_SERVER['HTTP_X_REQUESTED_WITH'] === 'XmlHttpRequest') {
return true;
}
// Otherwise end the request
header("HTTP/1.1 500 Internal Server Error");
return false;
}
function sendResponse($type)
{
// Set the headers in case of CORS request
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: X-Requested-With');
// The data you want to send via POST
$post_data = [
"client_id" => $YOUR_CLIENT_ID,
"client_secret" => $YOUR_CLIENT_SECRET,
"grant_type" => $type === 'refresh' ? "refresh_token" : "authorization_code",
"refresh_token" => $type === 'refresh' ? $_POST['refresh_token'] : "",
"code" => $type === 'refresh' ? "" : $_POST['code'],
"redirect_uri" => "postmessage",
"code_verifier" => ""
];
// url-ify the data for the POST
$data_string = http_build_query($post_data);
// Open connection
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/x-www-form-urlencoded',
'Content-Length: ' . strlen($data_string),
));
// Set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, "https://oauth2.googleapis.com/token");
curl_setopt($ch, CURLOPT_PORT, 443);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
// SSL options are set for testing purposes
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
// So that curl_exec returns the contents of the cURL; rather than echoing it
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute post
$result = curl_exec($ch);
if (curl_errno($ch)) {
print curl_error($ch);
}
echo $result;
curl_close($ch);
}
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') { // Handle preflight request (in case of CORS request)
header('Access-Control-Allow-Origin: *'); // Use your own domain instead of the '*'
header('Access-Control-Allow-Headers: X-Requested-With');
} else if (htmlspecialchars($_GET["action"]) === 'auth') { // Handle auth
if (checkCSRF()) {
sendResponse('auth');
}
} else if (htmlspecialchars($_GET["action"]) === 'refresh') { // Handle refresh
if (checkCSRF()) {
sendResponse('refresh');
}
}
```
### API
Configuration options
### apiKey
string
The API Key obtained from the Google API Console Credentials page.
### auth
"client" | "server"
When set to `'server'`, server-side endpoints must be implemented to get the auth access token from Google.
### authUrl
string
Server side endpoint for receiving an access token from Google on sign in, when the `auth` option is set to `'server'`.
### clientId
string
The client ID obtained from the Google API Console Credentials page.
### gapi
any
The gapi object, if already loaded. If not specified, the library will load it.
### gis
any
The Google Identity Services client library, if already loaded. If not specified, the library will load it.
### refreshUrl
string
Server side endpoint for receiving a new access token from Google on expiry, when the `auth` option is set to `'server'`.
### scopes
string
Specify custom scopes for Google authentication.
The default scopes are
`'https://www.googleapis.com/auth/calendar.events.public.readonly https://www.googleapis.com/auth/calendar.readonly https://www.googleapis.com/auth/calendar.events.owned'`
### timezone
string
If specified, the event dates will be returned in this timezone.
### timezonePlugin
[MbscTimezonePlugin](#type-MbscTimezonePlugin)
The timezone plugin, needed if timezone is specified.
The [`MbscTimezonePlugin`](#type-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* -
Events
### onInit
() => void
Callback executed when the library is initialized and ready to use.
### onSignedIn
() => void
Callback executed when the user signed in.
### onSignedOut
() => void
Callback executed when the user signed out.
Methods
### addEvent
(calendarId: string, event: [MbscCalendarEvent](#type-MbscCalendarEvent), callback: (addedEvent: [MbscCalendarEvent](#type-MbscCalendarEvent)) => void
) => Promise
Adds an event to the specified calendar.
```js title="Example usage"
googleCalendarSync.addEvent(
'MY_CALENDAR_ID',
{
start: new Date(2022, 1, 15, 12),
end: new Date(2022, 1, 16, 14),
title: 'My new event',
googleEvent: {
description: 'My new event description'
}
});
```
Parameters:
- calendarId - The ID of the calendar
- event - The event to add. You can pass Google specific event properties through the `googleEvent` property.
The rest of custom properties will be passed to the `extendedProperties` field.
- callback - Callback function which is executed when the request is complete. Receives the added event.
### deleteEvent
(calendarId: string, event: [MbscCalendarEvent](#type-MbscCalendarEvent), callback: (deletedEvent: [MbscCalendarEvent](#type-MbscCalendarEvent)) => void
) => Promise
Removes an event in the specified calendar.
Parameters:
- calendarId - The ID of the calendar
- event - The event to delete
- callback - Callback function which is executed then the request is complete. Receives the deleted event.
### getCalendars
(callback: (calendars: Array) => void
) => Promise
Queries the available calendars of the signed in user.
Calls the callback function, if specified.
Parameters:
- callback - A callback function to call with the calendars as parameters, when the query finished.
### getEvents
(calendarIds: string | Array, start: Date, end: Date, callback: (events: Array<[MbscCalendarEvent](#type-MbscCalendarEvent)>) => void
) => Promise
Queries the events of the specified calendars between two dates.
Parameters:
- calendarIds - Array of the calendar IDs.
- start - Start date of the specified interval.
- end - End date of the specified interval.
- callback - Callback function which is executed then the request is complete. Receives the list of events as parameter.
### init
(config: MbscGoogleCalendarSyncConfig) => void
Makes the necessary initializations for the 3rd party.
Triggers the `onInit` event when the initialization is ready, if specified.
Parameters:
- config - The configuration object for the calendar integration
### isSignedIn
() => boolean
Checks if the user is signed in or not.
### signIn
() => Promise
If the user is not signed in, starts the sign in flow. On success, triggers the `onSignedIn` event.
### signOut
() => Promise
If the user is signed in, signs out. On success triggers the `onSignedOut` event.
### updateEvent
(calendarId: string, event: [MbscCalendarEvent](#type-MbscCalendarEvent), callback: (updatedEvent: [MbscCalendarEvent](#type-MbscCalendarEvent)) => void
) => Promise
Updates an event in the specified calendar.
```js title="Example usage"
googleCalendarSync.updateEvent(
'MY_CALENDAR_ID',
{
start: new Date(2022, 1, 20, 10),
end: new Date(2022, 1, 11, 15),
title: 'My updated event',
id: 1,
googleEvent: {
description: 'My updated event description'
}
});
```
Parameters:
- calendarId - The ID of the calendar
- event - The event to update. You can pass Google specific event properties through the `googleEvent` property.
The rest of custom properties will be passed to the `extendedProperties` field.
- callback - Callback function which is executed then the request is complete. Receives the updated event.
## Outlook calendar integration
The Outlook Calendar Integration is a part of the third party calendar integrations plugin that manages the synchronization with your Outlook calendar services.
### Outlook calendars
Calling the `init` function will do the necessary initializations for the third party. For this step you need to use a [client ID](https://docs.microsoft.com/en-us/graph/auth-v2-user). After the init, you can sign in, list your calendars and events and create, update or delete the events on the calendars you have permission to.
```js
const calInst = mobiscroll.eventcalendar('#myDiv'. {
view: { schedule: { type: 'week' }},
});
// init outlook client
outlookCalendarSync.init({
clientId: 'YOUR_CLIENT_ID',
onSignedIn: () => {
outlookCalendarSync.getEvents(
['MY_FIRST_CALENDAR_ID', 'MY_SECOND_CALENDAR_ID'],
new Date(2022, 1, 1),
new Date(2022, 3, 0)
).then((events) => {
calInst.setEvents(events);
});
},
onSignedOut: () => {
calInst.setEvents([]);
},
});
```
### API
Configuration options
### clientId
string
The client ID obtained from the Outlook web app.
### msal
any
The Microsoft Authentication Library, if already loaded. If not specified, the library will load it.
### msalClient
any
The instance of the client application, if already loaded. If not specified, the library will load it.
### pageSize
number
The maximum number of events to retrieve with one request. Default value is `1000`.
### redirectUri
string
The location where the authorization server sends the user once the app has been successfully authorized.
Default value is `'http://localhost:3000'`.
### timezone
string
If specified, the event dates will be returned in this timezone.
### timezonePlugin
[MbscTimezonePlugin](#type-MbscTimezonePlugin)
The timezone plugin, needed if timezone is specified.
The [`MbscTimezonePlugin`](#type-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* -
Events
### onInit
() => void
Callback executed when the library is initialized and ready to use.
### onSignedIn
() => void
Callback executed when the user signed in.
### onSignedOut
() => void
Callback executed when the user signed out.
Methods
### addEvent
(calendarId: string, event: [MbscCalendarEvent](#type-MbscCalendarEvent), callback: (addedEvent: [MbscCalendarEvent](#type-MbscCalendarEvent)) => void
) => Promise
Adds an event to the specified calendar.
```js title="Example usage"
outlookCalendarSync.addEvent(
'MY_CALENDAR_ID',
{
start: new Date(2022, 1, 15, 12),
end: new Date(2022, 1, 16, 14),
title: 'My new event',
outlookEvent: {
isReminderOn: true,
}
});
```
Parameters:
- calendarId - The ID of the calendar
- event - The event to add. You can pass Outlook specific event properties through the `outlookEvent` property.
- callback - Callback function which is executed when the request is complete. Receives the added event.
### deleteEvent
(calendarId: string, event: [MbscCalendarEvent](#type-MbscCalendarEvent), callback: (deletedEvent: [MbscCalendarEvent](#type-MbscCalendarEvent)) => void
) => Promise
Removes an event in the specified calendar.
Parameters:
- calendarId - The ID of the calendar
- event - The event to delete
- callback - Callback function which is executed then the request is complete. Receives the deleted event.
### getCalendars
(callback: (calendars: Array) => void
) => Promise
Queries the available calendars of the signed in user.
Calls the callback function, if specified.
Parameters:
- callback - A callback function to call with the calendars as parameters, when the query finished.
### getEvents
(calendarIds: string | Array, start: Date, end: Date, callback: (events: Array<[MbscCalendarEvent](#type-MbscCalendarEvent)>) => void
) => Promise
Queries the events of the specified calendars between two dates.
Parameters:
- calendarIds - Array of the calendar IDs.
- start - Start date of the specified interval.
- end - End date of the specified interval.
- callback - Callback function which is executed then the request is complete. Receives the list of events as parameter.
### init
(config: MbscOutlookCalendarSyncConfig) => void
Makes the necessary initializations for the 3rd party.
Triggers the `onInit` event when the initialization is ready, if specified.
Parameters:
- config - The configuration object for the calendar integration
### isSignedIn
() => boolean
Checks if the user is signed in or not.
### signIn
() => Promise
If the user is not signed in, starts the sign in flow. On success, triggers the `onSignedIn` event.
### signOut
() => Promise
If the user is signed in, signs out. On success triggers the `onSignedOut` event.
### updateEvent
(calendarId: string, event: [MbscCalendarEvent](#type-MbscCalendarEvent), callback: (updatedEvent: [MbscCalendarEvent](#type-MbscCalendarEvent)) => void
) => Promise
Updates an event in the specified calendar.
```js title="Example usage"
outlookCalendarSync.updateEvent(
'MY_CALENDAR_ID',
{
start: new Date(2022, 1, 20, 10),
end: new Date(2022, 1, 11, 15),
title: 'My updated event',
id: 1,
outlookEvent: {
isReminderOn: false,
}
});
```
Parameters:
- calendarId - The ID of the calendar
- event - The event to update. You can pass Outlook specific event properties through the `outlookEvent` property.
- callback - Callback function which is executed when the request is complete. Receives the updated event.
---
## Working with recurring events
## Querying recurring events
The Calendar Integration when queries recurring events from the Google or the Outlook calendar, it will receive individual event occurences for the given period of time. So every event arrives as an individual event. The Mobiscroll Eventcalendar won't know about the recurrence in these cases.
To tell whether these events are part of a recurring set or not, you need to check the properties of the event.
1. The google event has the `event.googleEvent.recurringEventId` field set in case of recurring events - which is the ID of the original recurring event.
2. The outlook event has the `event.outlookEvent.type` field set to `occurrence` in case of a recurring events, otherwise the type is `singleInstance`
## Creating recurring events
When you want to create a recurring event through the Mobiscroll Eventcalendar, you can do so by setting the `recurrence` field to the RRULE before sending it to the Google or Outlook calendar. For example:
```js title="Create a recurring event in a Google calendar"
const onEventCreate = (args, inst) => {
const event = args.event;
event.googleEvent = {
recurrence: ['RRULE:FREQ=WEEKLY;BYDAY=TH;COUNT=4'],
// ...other google specific properties
}
// then send it to Google
googleCalendarSync.addEvent('MY_CALENDAR_ID', event);
}
```
When this is done, the [getEvents](./calendar-integrations.md#method-google-getEvents) function will return the individual occurences of the recurring set, the same way it is described [above](#querying-recurring-events).
## Updating a single recurring instance
To update a single occurence of a recurring event, you can drag it on the Eventcalendar UI (when the [dragToMove](../api#opt-dragToMove) option is enabled). Since the events you get from the calendar integrations are individual occurences, updating one will not update the whole set of recurring events. So updating a single instance of the recurring set is the default behavior.
## Deleting a recurring instance
As mentioned above in the [query section](#querying-recurring-events), by default you get the recurring event occurences as single individual events, when querying events from Google or Outlook calendars. Deleting a single event instance will only remove that single instance from the set.
## Updating a recurring event
To update the whole recurring set or parts of it (for example: this and following events), you will need to use direct API calls to the Google or Outlook calendars themselves, since this is not supported by the Calendar Integrations currently.
Here's a link for a more detailed description on [how to update recurring events with the Google Calendars](https://developers.google.com/calendar/api/guides/recurringevents).
For Outlook recurring events check out the [Outlook schedule recurring events guide](https://learn.microsoft.com/en-us/graph/outlook-schedule-recurring-events).
---
## Calendar
Use the [Event Calendar](https://demo.mobiscroll.com/eventcalendar) as a traditional [month view](https://demo.mobiscroll.com/eventcalendar/desktop-month-view#) or combine it with an agenda as a [week view](https://demo.mobiscroll.com/agenda/daily-agenda-with-week-calendar#).
The events can be rendered as [labels](https://demo.mobiscroll.com/eventcalendar/event-labels#) or in a [popover](https://demo.mobiscroll.com/eventcalendar/event-popover#) that is shown on day click.
## Overview
The Calendar view supports everything from [single to multiple week views](https://demo.mobiscroll.com/eventcalendar/month-week-view#) all the way to [month grids](https://demo.mobiscroll.com/eventcalendar/quarter-year-view#) with various ways to render events.
The capabilities like [recurring events](/javascript/core-concepts/recurrence), [all-day, multi-day events](#opt-data), [responsiveness](#responsiveness) are supported by the Event Calendar.

## Showing the Calendar
### View combination
The four views - [scheduler](./scheduler), [calendar](./calendar), [timeline](./timeline), [agenda](./agenda) - can be used alone or combined with each-other to create the perfect user experience on mobile, desktop and on everything in-between.
For example, you can choose to [render an agenda below the calendar](https://demo.mobiscroll.com/agenda/daily-agenda-with-week-calendar#) broken up into days ordered chronologically. The view option will look like the following:
```javascript title='Weekly Calendar combined with Daily Agenda'
mobiscroll.eventcalendar('#calendar', {
view: {
calendar: {
type: 'week'
},
agenda: {
type: 'day'
}
}
});
```
### Configuring the view
The Calendar view can be configured through the `view` option. Below are listed the `calendar` object properties which can help you fine-tune this view.
```javascript title='Example'
mobiscroll.eventcalendar('#calendar', {
view: {
calendar: {
labels: true,
type: 'week',
size: 2
}
}
});
```
### count
boolean
If `true`, it will display the number of events on the days with events.
**Default value**: `false`
### eventDisplay
"fill" | "exact"
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.
**Default value**: `'fill'`
### labels
number | boolean | "all"
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](#opt-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 become 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.
**Default value**: `true`
### outerDays
boolean
Show or hide days from previous and next months. Hiding only works for type: 'month'.
**Default value**: `false`
### popover
boolean
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.
**Default value**: `undefined`
### popoverClass
string
A CSS class that's added to the popover element.
Can be used to customize the styling of the popover on a calendar basis.
### scroll
"horizontal" | "vertical"
Specifies the direction of the calendar scroll. Can be 'horizontal' or 'vertical'
**Default value**: `'horizontal'`
### size
number
Specifies the number of displayed weeks/months.
**Default value**: `1`
### type
"month" | "year" | "week"
Specifies the calendar type
**Default value**: `'month'`
### weekNumbers
boolean
Show or hide week numbers.
**Default value**: `false`
## Responsiveness
The Event Calendar is [fully responsive](https://demo.mobiscroll.com/eventcalendar/responsive-month-view). It adapts to the available space and fills the screen to look good everywhere. While you don't have to worry about the width the height can be manually adjusted with the [height](#opt-height) option. This 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.
Use the [responsive](#opt-responsive) option to configure how the calendar behaves on different sized screens.
The responsive option is equipped with five breakpoints:
- `xsmall` (up to 575px),
- `small` (up to 767px),
- `medium` (up to 991px),
- `large` (up to 1199px),
- `xlarge` (from 1200px).
Also, custom breakpoints can be added if necessary:
- `my-custom-breakpoint: { breakpoint: 600 }` (from 600px up to the next breakpoint).
:::info
The available width is queried from the container element of the component and not the browsers viewport like in css media queries.
:::
```javascript title='Responsive configuration with the view option'
mobiscroll.eventcalendar('#calendar', {
responsive: {
xsmall: {
view: {
calendar: { type: 'week' },
agenda: { type: 'day' }
}
},
custom: { // Custom breakpoint, you can use multiple if needed, but each must have a unique name.
breakpoint: 600,
view: { calendar: { labels: true }}
}
}
});
```

## Templating
The display of Calendar can be customized with different [render functions](#renderers).
### The event label and their content
There are two approaches you can take:
- Customize the label contents, that appears on the calendar - for this you will want to use the [renderLabelContent](#renderer-renderLabelContent) option. The Event Calendar will take care of styling and you can focus on what you show inside of the label.
- Customize the labels that appear on the calendar view - use the [renderLabel](#renderer-renderLabel) option. The Event Calendar will take care of the positioning, but everything else (like background color, hover effect, etc.) is left to you.
Check out how you can style labels and their content in [this example](https://demo.mobiscroll.com/eventcalendar/customize-label-look-and-feel#) or just play with the slider below to see the differences.
### The event in popover and their content
The events can be customized in two ways:
- Customize the event content that appears on the popover - by using the [renderEventContent](#renderer-renderEventContent) option. The Event Calendar will take care of styling and you can focus on what you show inside of the event.
- Customize the events that appear on the popover - with the [renderEvent](#renderer-renderEvent) option. It should return the markup of the event. The Event Calendar will take care of the positioning, but everything else (like background color, hover effect, etc.) is left to you.
Check out how you can style events and their content in [this example](https://demo.mobiscroll.com/eventcalendar/customize-event-popover#) or just play with the slider below to see the differences.
### The event calendar header
Customize how the header of the Event Calendar looks and how the components are arranged with the [renderHeader](#renderer-renderHeader) option. It takes a function that should return the desired markup. In the returned markup, you can use custom html as well as the built in header components of the calendar.
While fully customizing the header is very usefull, sometimes it's desireable to customize only parts of it. In this case you can take advantage of the default header's [building blocks](/javascript/eventcalendar/templating#header-templating). These components let you put toghether the header you want, while you don't have to worry about the functionality behind them.
Check out how you can style the header in [this example](https://demo.mobiscroll.com/javascript/eventcalendar/customizing-header#) or just play with the slider below to see the differences.
## Event order
The rendered event order is determined by the following two concepts:
1. Event data order
2. Event layout
The combination of these concepts results in the final rendered event order.
### Event data order
The sequence in which events are processed before being passed to the layout algorithm. The default ordering rules are as follows:
1. All-day events are placed at the top.
2. Non-all-day events follow, sorted by their start times.
3. Events with the same start time are further ordered alphabetically by their titles.
This default order can be modified using the `order` property in the event [event data](#opt-data). The order property takes precedence over the default rules. If two events have the same order value, the default rules apply. For more complex ordering requirements, the [eventOrder](#opt-eventOrder) option can be used. This option accepts a function that compares two events and returns an order (-1 or 1).
### Event layout
The event layout process determines the visual positioning and dimensions of events. This is a built-in functionality and cannot be altered externally. The layout algorithm processes the sorted event list and calculates each event's position and size. The algorithm follows these steps:
1. The first event is placed in the first position of the event track.
2. If two or more events overlap in their start/end times, the later event is placed in the next event track, positioned below to the previous event.
3. If a subsequent event does not overlap with any already added events, it is placed back in the first event track.
4. This process continues until all events are positioned within their respective rows.
## API
Here is a comprehensive list of all the specific options, events and methods of the Event Calendar view.
### Options
Explore the following API options that help you easily configure the Event Calendar.
### 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](#opt-dragToCreate) option.
Using the [extendDefaultEvent](#opt-extendDefaultEvent) option extra properties can be set for the created event.
The event deletion functionality can be overwritten using the [eventDelete](#opt-eventDelete) option.
**Default value**: `undefined`
### colors
Array<[MbscCalendarColor](#type-MbscCalendarColor)>
Specifies the color for certain dates or date ranges on the calendar.
The [`MbscCalendarColor`](#type-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 color
- `end`: *string | object | Date* - Specifies the end date/time of a date/time range for the color
- `highlight`: *string* - Highlight color of the day, can be any valid CSS color (`'red'`, `'#ff0000'`, `'rgb(255, 0, 0)'`, etc.).
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring days.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Exception rule of the recurring rule.
Useful when recurring dates need to be skipped from the rule.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 color
- `textColor`: *string* - A color applied on the text.
- `title`: *string* - A title that will be displayed on the item.
:::info
The colored range will be considered all-day if:
- the `allDay` property is explicitly set.
- the `start` / `end` properties are not specified, only the `date`.
:::
:::info
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
:::
:::info
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
:::
:::info
The colors can be combined with the [labels](#opt-labels) or [marked](#opt-marked) options.
:::
```js
[
{ 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`
### 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](#type-MbscCalendarEvent)>
The events for the Eventcalendar.
The [`MbscCalendarEvent`](#type-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 event
- `cssClass`: *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 event
- `dragBetweenResources`: *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 event
- `id`: *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 the `eventOverlap`
property of the resource and the [eventOverlap](#opt-eventOverlap) option.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring events.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 the `eventResize` property of the resource and
the [dragToResize](#opt-dragToResize) option.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 event
- `textColor`: *string* - A color applied on the text.
- `timezone`: *string* - Timezone of the event
- `title`: *string* - The title of the event.
- `tooltip`: *string* - The tooltip text of the event.
:::info
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
:::
:::info
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
:::
:::info
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-onEventClick) event will receive the event object as argument, containing the custom properties as well.
:::
:::info
Use the [getEvents](#method-getEvents) method to get the events between two dates.
:::
```js
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.
:::info
When using timezones, the [exclusiveEndDates](#opt-exclusiveEndDates) option is also turned on by default.
:::
:::info
When using anything other than the default (`'local'`), a [timezone plugin](#opt-timezonePlugin)
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](https://gist.github.com/aviflax/a4093965be1cd008f172), e.g. `"America/New_York"`.
If not specified, it defaults to the [displayTimezone](#opt-displayTimezone).
**Default value**: `undefined`
### defaultSelectedDate
[MbscDateType](#type-MbscDateType)
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.
:::info
When using timezones, the [exclusiveEndDates](#opt-exclusiveEndDates) option is also turned on by default.
:::
:::info
When using anything other than the default (`'local'`), a [timezone plugin](#opt-timezonePlugin)
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](https://gist.github.com/aviflax/a4093965be1cd008f172), e.g. `"America/New_York"`.
**Default value**: `'local'`
### 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](#opt-dragBetweenResources) option.
Consider that [dragToMove](#opt-dragToMove) has to be enabled.
**Default value**: `true`
### 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](#opt-newEventText) option.
Using the [extendDefaultEvent](#opt-extendDefaultEvent) option extra properties can be set for the created event.
The event deletion functionality can be overwritten using the [eventDelete](#opt-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](#opt-clickToCreate) and [dragToCreate](#opt-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](#type-MbscCalendarEvent), event2: [MbscCalendarEvent](#type-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.
:::info
When using timezones, the `exclusiveEndDates` option will default to `true`.
:::
### extendDefaultEvent
(args: MbscNewEventData) => void | [MbscCalendarEvent](#type-MbscCalendarEvent)
Use this option to set properties to the new event created with click or drag.
The event creation is handled by the [clickToCreate](#opt-clickToCreate) and [dragToCreate](#opt-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.
```js
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`
### 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](#type-MbscDateType)> | Array<[MbscCalendarInvalid](#type-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* - 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* - Specifies the [resource](#opt-resources) 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](#opt-slots) 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.
:::info
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
:::
:::info
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
:::
```js
[
// 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-MbscCalendarInvalid) type has the following properties:
- `allDay`: *boolean* - If true the specified invalid will cover the whole day.
- `end`: *[MbscDateType](#type-MbscDateType)* - Specifies the end of the invalid range.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Recurrence rule for recurring invalid ranges.
- `recurringException`: *[MbscDateType](#type-MbscDateType) | Array<[MbscDateType](#type-MbscDateType)>* - Specifies recurring exceptions.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence exception rule.
Useful when recurring dates need to be skipped from the rule.
- `start`: *[MbscDateType](#type-MbscDateType)* - Specifies the start of the invalid range.
### invalidateEvent
"strict" | "start-end"
Specifies how to validate events against [invalid](#opt-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](#type-MbscCalendarLabel)>
Specifies labels for calendar days.
The [`MbscCalendarLabel`](#type-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 label
- `end`: *string | object | Date* - Specifies the end date/time of a date/time range for the label
- `order`: *number* - Specifies the order of the label in the array. Has precedence over the default ordering rules.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring days.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 label
- `textColor`: *string* - A color applied on the text.
- `title`: *string* - The title of the label.
- `tooltip`: *string* - Tooltip for the label
:::info
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
:::
:::info
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
:::
:::info
The labels can be combined with the [colors](#opt-colors) option.
:::
```js
[
{
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](#type-MbscCalendarMarked)>
Mark certain dates on the calendar. An array containing dates, or objects with the following properties:
The [`MbscCalendarMarked`](#type-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 applicable
- `end`: *string | object | Date* - Specifies the end date/time of a date/time range when this is applicable
- `markCssClass`: *string* - CSS class for the mark.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring days.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 applicable
- `textColor`: *string* - A color applied on the text.
- `title`: *string* - A title that will be displayed on the item.
:::info
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
:::
:::info
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
:::
:::info
The marked days can be combined with the [colors](#opt-colors) option.
:::
```js
[
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
[MbscDateType](#type-MbscDateType)
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](#opt-invalid) option with daily recurrence starting from the specific date.
**Default value**: `undefined`
### min
[MbscDateType](#type-MbscDateType)
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](#opt-invalid) option with daily recurrence until the specific date.
**Default value**: `undefined`
### modules
Array
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.
```js
// import the print module
// later on, add it to the modules array:
modules: [print]
```
### refDate
[MbscDateType](#type-MbscDateType)
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](#opt-selectedDate) option.
**Default value**: `undefined`
### responsive
[MbscResponsiveOptions](#type-MbscResponsiveOptions)
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.
:::info
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: 0px
- `small` - min-width: 576px
- `medium` - min-width: 768px
- `large` - min-width: 992px
- `xlarge` - 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
[MbscDateType](#type-MbscDateType)
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](#opt-refDate) option.
You also need to pass a handler for the [onSelectedDateChange](#event-onSelectedDateChange) event
to update the selected date when the date is changed from the calendar.
**Default value**: `undefined`
### selectedEvents
Array<[MbscCalendarEvent](#type-MbscCalendarEvent)>
Specifies the selected events on the calendar. The [onSelectedEventsChange](#event-onSelectedEventsChange) event will be
fired when the selected events change from the calendar.
The [`MbscCalendarEvent`](#type-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 event
- `cssClass`: *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 event
- `dragBetweenResources`: *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 event
- `id`: *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 the `eventOverlap`
property of the resource and the [eventOverlap](#opt-eventOverlap) option.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring events.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 the `eventResize` property of the resource and
the [dragToResize](#opt-dragToResize) option.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 event
- `textColor`: *string* - A color applied on the text.
- `timezone`: *string* - Timezone of the event
- `title`: *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](#opt-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`
### 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](../theming/sass-variables) or
[create custom themes](../theming/sass-themes).
:::info
Make sure that the theme you set is included in the downloaded package.
:::
**Default value**: `undefined`
### themeVariant
"auto" | "light" | "dark"
Controls which variant of the [theme](#opt-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'` or `undefined` - 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
[MbscTimezonePlugin](#type-MbscTimezonePlugin)
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](https://momentjs.com/timezone/)
and [luxon](https://moment.github.io/luxon/#/).
You can specify either the [dataTimezone](#opt-dataTimezone) or the [displayTimezone](#opt-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-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* -
### width
string | number
Sets the width of the component.
**Default value**: `undefined`
### Events
The Event Calendar 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.
### onCellClick
(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* - The events for the clicked date.
- `resource`: *string | number* - The id of the resource where the cell was clicked, if [resources](#opt-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.
### onCellDoubleClick
(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* - The events for the clicked date.
- `resource`: *string | number* - The id of the resource where the cell was clicked, if [resources](#opt-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.
### onCellHoverIn
(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* - The colors for the hovered cell.
- `date`: *Date* - The date of the hovered day.
- `events`: *Array* - The events for the hovered cell.
- `invalids`: *Array* - The invalid dates for the hovered cell.
- `labels`: *Array* - If the cell has labels, contains the label objects for the hovered cell.
- `marked`: *Array* - 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.
### onCellHoverOut
(args: MbscCellHoverEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer leaves a day on the calendar view (does not apply for agenda view).
Parameters:
- args - The event argument with the following properties:
- `colors`: *Array* - The colors for the hovered cell.
- `date`: *Date* - The date of the hovered cell.
- `events`: *Array* - The events for the hovered cell.
- `invalids`: *Array* - The invalid dates for the hovered cell.
- `labels`: *Array* - If the cell has labels, contains the label objects for the hovered cell.
- `marked`: *Array* - 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.
### onCellRightClick
(args: MbscCellClickEvent, inst: EventcalendarBase) => void
Triggered when a cell is right-clicked on the calendar, scheduler, or timeline grid .
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* - The events for the clicked date.
- `resource`: *string | number* - The id of the resource where the cell was clicked, if [resources](#opt-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.
### onDestroy
(args: any, inst: any) => void
Triggered when the component is destroyed.
Parameters:
- args - The event argument object.
- inst - The component instance.
### onEventClick
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when an event is clicked.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was clicked.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the click.
- `event`: *MbscCalendarEvent* - The clicked calendar event.
- `resource`: *string | number* - The id of the resource where the event was clicked, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was clicked, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was clicked, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was clicked, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was clicked.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventCreate
(args: MbscEventCreateEvent, inst: EventcalendarBase) => void
Triggered when an event is about to create and it is not yet rendered on its final position.
Event creation can be prevented by returning `false` from the handler function.
Parameters:
- args - The event argument with the following properties:
- `action`: *'click' | 'drag' | 'externalDrop'* - The action which created the event.
- `domEvent`: *Event* - The DOM event from the end of the gesture (mouseup or touchend).
- `event`: *MbscCalendarEvent* - The newly created event.
- `originEvent`: *MbscCalendarEvent* - The occurrence of the event which was dragged.
Will be set only if the event was created by dragging a recurring event occurrence.
- `resourceObj`: *MbscResource* - The resource where the event is being created, if [resources](#opt-resources) are set.
- `slotObj`: *MbscSlot* - The slot where the event is being created, if [slots](#opt-slots) are set.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event is being created.
- inst - The component instance.
### onEventCreateFailed
(args: MbscEventCreateFailedEvent, inst: EventcalendarBase) => void
Triggered when an event creation failed due to overlapping an invalid range or another event.
Parameters:
- args - The event argument with the following properties:
- `action`: *'click' | 'drag' | 'externalDrop'* - The action which created the event.
- `event`: *MbscCalendarEvent* - The newly created event.
- `invalid`: *object* - The invalid object which the event overlapped.
- `overlap`: *MbscCalendarEvent* - The overlapped event.
- `originEvent`: *MbscCalendarEvent* - The occurrence of the event which was dragged.
Will be set only if the event was created by dragging a recurring event occurrence.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event was created.
- inst - The component instance.
### onEventCreated
(args: MbscEventCreatedEvent, inst: EventcalendarBase) => void
Triggered when an event is created and it is rendered in its position.
Parameters:
- args - The event argument with the following properties:
- `action`: *'click' | 'drag' | 'externalDrop'* - The action which created the event.
- `event`: *MbscCalendarEvent* - The newly created event.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event was created.
- `target`: *HTMLElement* - The DOM element of the created event.
- `resourceObj`: *MbscResource* - The resource where the event is being created, if [resources](#opt-resources) are set.
- `slotObj`: *MbscSlot* - The slot where the event is being created, if [slots](#opt-slots) are set.
- inst - The component instance.
### onEventDelete
(args: MbscEventDeleteEvent, inst: EventcalendarBase) => void
Triggered when an event is about to be deleted and it is not yet removed from the view.
Event deletion can be performed with delete and backspace button on an active event.
Deletion can be prevented by returning `false` from the handler function.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event from of the keydown action.
- `event`: *MbscCalendarEvent* - The event being deleted.
- `events`: *Array* - The events being deleted in case of multiple event selection.
- `source`: *'agenda' | 'calendar' | 'timeline' | 'schedule'* - The view where the event is being deleted.
- inst - The component instance.
### onEventDeleted
(args: MbscEventDeletedEvent, inst: EventcalendarBase) => void
Triggered when an event is deleted and it is removed from the view.
Parameters:
- args - The event argument with the following properties:
- `event`: *MbscCalendarEvent* - The deleted event.
- `events`: *Array* - The deleted events in case of multiple event selection.
- `source`: *'agenda' | 'calendar' | 'timeline' | 'schedule'* - The view where the event was deleted.
- inst - The component instance.
### onEventDoubleClick
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when an event is double-clicked.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was clicked.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the click.
- `event`: *MbscCalendarEvent* - The clicked calendar event.
- `resource`: *string | number* - The id of the resource where the event was clicked, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was clicked, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was clicker, if [slots](#opt-slots) are set.
- `slotObj`: *MbscResource* - The resource where the event was clicker, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was clicked.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventDragEnd
(args: MbscEventDragEvent, inst: EventcalendarBase) => void
Triggered when an event drag has ended.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the drag.
- `event`: *MbscCalendarEvent* - The dragged calendar event.
- `resource`: *string | number* - The id of the resource where the event was dragged, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was dragged, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was dragged, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was dragged, if [slots](#opt-slots) are set.
- `source`: *'calendar' | 'schedule' | 'timeline'* - The view where the event was dragged.
- inst - The component instance.
### onEventDragEnter
(args: MbscEventDragEvent) => void
Triggered when an event is dragged into the calendar/timeline/schedule view.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the drag.
- `event`: *MbscCalendarEvent* - The dragged calendar event.
- `source`: *'calendar' | 'schedule' | 'timeline'* - The view where the event is dragged.
### onEventDragLeave
(args: MbscEventDragEvent) => void
Triggered when an event is dragged out form the calendar/timeline/schedule view.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the drag.
- `event`: *MbscCalendarEvent* - The dragged calendar event.
- `source`: *'calendar' | 'schedule' | 'timeline'* - The view where the event is dragged.
### onEventDragStart
(args: MbscEventDragEvent, inst: EventcalendarBase) => void
Triggered when an event drag has started.
Parameters:
- args - The event argument with the following properties:
- `action`: *'create' | 'resize' | 'move'* - The user action which triggered the event.
- `domEvent`: *Event* - The DOM event of the drag.
- `event`: *MbscCalendarEvent* - The dragged calendar event.
- `resource`: *string | number* - The id of the resource where the event is dragged, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event is dragged, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event is dragged, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event is dragged, if [slots](#opt-slots) are set.
- `source`: *'calendar' | 'schedule' | 'timeline'* - The view where the event is dragged.
- inst - The component instance.
### onEventHoverIn
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer hovers an event on the calendar.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event is hovered.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the hover.
- `event`: *MbscCalendarEvent* - The hovered calendar event.
- `resource`: *string | number* - The id of the resource where the event is hovered, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event is hovered, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event is hovered, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event is hovered, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event is hovered.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventHoverOut
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer leaves an event on the calendar.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was hovered.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the hover.
- `event`: *MbscCalendarEvent* - The hovered calendar event.
- `resource`: *string | number* - The id of the resource where the event was hovered, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was hovered, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was hovered, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was hovered, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was hovered.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventRightClick
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when an event is right-clicked.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was clicked.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the click.
- `event`: *MbscCalendarEvent* - The clicked calendar event.
- `resource`: *string | number* - The id of the resource where the event was clicked, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was clicked, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was clicked, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was clicked, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was clicked.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventUpdate
(args: MbscEventUpdateEvent, inst: EventcalendarBase) => void
Triggered when an event is about to update. Update can be prevented by returning `false` from the handler function.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event from the end of the gesture (mouseup or touchend).
- `event`: *MbscCalendarEvent* - The updated event.
- `events`: *Array* - The updated events.
It is set on recurring event delete, when [multiple event selection](#opt-selectMultipleEvents) is enabled.
- `newEvent`: *MbscCalendarEvent* - The newly created event.
Will be set only if the dragged event was a recurring event occurrence.
- `oldEvent`: *MbscCalendarEvent* - The original event before the update.
- `oldEvents`: *Array* - The original events before the update.
It is set on recurring event delete, when [multiple event selection](#opt-selectMultipleEvents) is enabled.
- `oldEventOccurrence`: *MbscCalendarEvent* - The occurrence of the event which was dragged.
Will be set only if the dragged event was a recurring event occurrence.
- `oldResource`: number | string - The id of the resource from which the event was dragged.
- `oldResourceObj`: *MbscResource* - The resource from which the event was dragged.
- `oldSlot`: number | string - The id of the slot from which the event was dragged.
- `oldSlotObj`: *MbscSlot* - The slot from which the event was dragged.
- `resource`: number | string - The id of the resource where the event was dropped.
- `resourceObj`: *MbscResource* - The resource where the event was dropped.
- `slot`: number | string - The id of the slot where the event was dropped.
- `slotObj`: *MbscSlot* - The slot where the event was dropped.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event is being updated.
- inst - The component instance.
### onEventUpdateFailed
(args: MbscEventUpdateFailedEvent, inst: EventcalendarBase) => void
Triggered when an event update failed due to overlapping an invalid range or another event.
Parameters:
- args - The event argument with the following properties:
- `event`: *MbscCalendarEvent* - The updated event.
- `invalid`: *object* - The invalid object which the event overlapped.
- `overlap`: *MbscCalendarEvent* - The overlapped event.
- `newEvent`: *MbscCalendarEvent* - The newly created event.
Will be set only if the dragged event was a recurring event occurrence.
- `oldEvent`: *MbscCalendarEvent* - The original event before the update.
- `oldEventOccurrence`: *MbscCalendarEvent* - The occurrence of the event which was dragged.
Will be set only if the dragged event was a recurring event occurrence.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event was updated.
- inst - The component instance.
### onEventUpdated
(args: MbscEventUpdatedEvent, inst: EventcalendarBase) => void
Triggered when an event is updated and is rendered in its new position.
This is where you update the event in your database or persistent storage.
Parameters:
- args - The event argument with the following properties:
- `event`: *MbscCalendarEvent* - The updated event.
- `events`: *Array* - The updated events.
It is set on recurring event delete, when [multiple event selection](#opt-selectMultipleEvents) is enabled.
- `oldEvent`: *MbscCalendarEvent* - The original event before the update.
- `oldEvents`: *Array* - The original events before the update.
It is set on recurring event delete, when [multiple event selection](#opt-selectMultipleEvents) is enabled.
- `resourceObj`: *MbscResource* - The resource where the event is updated, if [resources](#opt-resources) are set.
- `slotObj`: *MbscSlot* - The slot where the event is updated, if [slots](#opt-slots) are set.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event was updated.
- `target`: *HTMLElement* - The DOM element of the updated event.
- inst - The component instance.
### onInit
(args: any, inst: any) => void
Triggered when the component is initialized.
Parameters:
- args - The event argument object.
- inst - The component instance.
### onLabelClick
(args: MbscLabelClickEvent, inst: EventcalendarBase) => void
Triggered when a label is clicked on the calendar.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date of the day on which the label was clicked.
- `domEvent`: *Event* - The DOM event of the click.
- `label`: *MbscCalendarLabel* - The original object of the label which was clicked, `undefined` in case of the "more" label.
- `labels`: *Array* - An array containing each label object for the given day.
- `target`: *HTMLElement* - The DOM element of the label.
- inst - The component instance.
### onPageChange
(args: MbscPageChangeEvent, inst: EventcalendarBase) => void
Triggered when the calendar page is changed (with buttons or swipe).
Parameters:
- args - The event argument with the following properties:
- `firstDay`: *Date* - The first day of the displayed page.
- `lastDay`: *Date* - The last day of the displayed page, as an exclusive end date, pointing to 00:00 of the next day.
- `month`: *Date* - The first day of the visible month in case of month view.
- inst - The component instance.
### onPageLoaded
(args: MbscPageLoadedEvent, inst: EventcalendarBase) => void
Triggered when the calendar page is changed (with buttons or swipe) and the view finished rendering.
Parameters:
- args - The event argument with the following properties:
- `firstDay`: *Date* - The first day of the displayed page.
- `lastDay`: *Date* - The last day of the displayed page, as an exclusive end date, pointing to 00:00 of the next day.
- `month`: *Date* - The first day of the visible month in case of month view.
- inst - The component instance.
### onPageLoading
(args: MbscPageLoadingEvent, inst: EventcalendarBase) => void
Triggered before the markup of a calendar page is starting to render.
Parameters:
- args - The event argument with the following properties:
- `firstDay`: *Date* - The first day of the displayed page.
- `lastDay`: *Date* - The last day of the displayed page, as an exclusive end date, pointing to 00:00 of the next day.
- `month`: *Date* - The first day of the visible month in case of month view.
- inst - The component instance.
### onSelectedDateChange
(args: MbscSelectedDateChangeEvent, inst: EventcalendarBase) => void
Triggered when the selected date is changed, e.g. by clicking on a day on a calendar view, or by using the navigation arrows.
You can use this event in conjunction with the [selectedDate](#opt-selectedDate) option
to customize where the Eventcalendar should navigate.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The newly selected date.
- inst - The component instance.
### onSelectedEventsChange
(args: MbscSelectedEventsChangeEvent, inst: EventcalendarBase) => void
Triggered when an event is selected or deselected on the UI,
when [multiple event selection](#opt-selectMultipleEvents) is enabled.
You can also select events programmatically using the [selectedEvents](#opt-selectedEvents) option.
Parameters:
- args - The event argument with the following properties:
- `events`: *Array* - The selected events.
- inst - The component instance.
### Localization
The Event Calendar is fully localized. This covers date and time format, button copy, rtl and more.
### allDayText
string
Text for all day events.
**Default value**: `'All-day'`
### amText
string
Text for AM.
**Default value**: `'am'`
### calendarSystem
MbscCalendarSystem
Specifies the calendar system to be used. Supported calendars:
- Gregorian - Gregorian calendar. This is the default calendar system.
- Jalali - Persian calendar. The Farsi language needs to be included to the package.
- Hijri - Hijri calendar. The Arabic language needs to be included to the package
**Default value**: `undefined`
### dateFormat
string
The format for parsed and displayed dates:
- `M` - month of year (no leading zero)
- `MM` - month of year (two digit)
- `MMM` - month name short
- `MMMM` - month name long
- `D` - day of month (no leading zero)
- `DD` - day of month (two digit)
- `DDD` - day of week (short)
- `DDDD` - day of week (long)
- `YY` - year (two digit)
- `YYYY` - year (four digit)
- `'...'` - literal text
- `''` - single quote
- anything else - literal text
**Default value**: `'MM/DD/YYYY'`
### dateFormatFull
string
Human readable date format, used by screen readers to read out full dates.
Characters have the same meaning as in the [dateFormat](#localization-dateFormat) option.
**Default value**: `'DDDD, MMMM D, YYYY'`
### dayNames
Array
The list of long day names, starting from Sunday.
**Default value**: `['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']`
### dayNamesMin
Array
The list of minimal day names, starting from Sunday.
**Default value**: `['S', 'M', 'T', 'W', 'T', 'F', 'S']`
### dayNamesShort
Array
The list of abbreviated day names, starting from Sunday.
**Default value**: `['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']`
### eventText
string
Text for the event word.
**Default value**: `'event'`
### eventsText
string
Text for the events word (plural).
**Default value**: `'events'`
### firstDay
number
Set the first day of the week: Sunday is 0, Monday is 1, etc.
**Default value**: `0`
### locale
[MbscLocale](#type-MbscLocale)
Sets the language of the component. The locale object contains all the translations for a given language.
The built in language modules are listed below. If a language is not listed, it can be provided as a
[custom language module](https://mobiscroll.com/docs/core-concepts/localization#language-modules).
Supported values:
- Arabic: `localeAr`, `'ar'`
- Bulgarian: `localeBg`, `'bg'`
- Catalan: `localeCa`, `'ca'`
- Czech: `localeCs`, `'cs'`
- Chinese: `localeZh`, `'zh'`
- Croatian: `localeHr`, `'hr'`
- Danish: `localeDa`, `'da'`
- Dutch: `localeNl`, `'nl'`
- English: `localeEn` or `undefined`, `'en'`
- English (UK): `localeEnGB`, `'en-GB'`
- Farsi: `localeFa`, `'fa'`
- German: `localeDe`, `'de'`
- Greek: `localeEl`, `'el'`
- Spanish: `localeEs`, `'es'`
- Finnish: `localeFi`, `'fi'`
- French: `localeFr`, `'fr'`
- Hebrew: `localeHe`, `'he'`
- Hindi: `localeHi`, `'hi'`
- Hungarian: `localeHu`, `'hu'`
- Italian: `localeIt`, `'it'`
- Japanese: `localeJa`, `'ja'`
- Korean: `localeKo`, `'ko'`
- Lithuanian: `localeLt`, `'lt'`
- Norwegian: `localeNo`, `'no'`
- Polish: `localePl`, `'pl'`
- Portuguese (Brazilian): `localePtBR`, `'pt-BR'`
- Portuguese (European): `localePtPT`, `'pt-PT'`
- Romanian: `localeRo`, `'ro'`
- Russian: `localeRu`, `'ru'`
- Russian (UA): `localeRuUA`, `'ru-UA'`
- Slovak: `localeSk`, `'sk'`
- Serbian: `localeSr`, `'sr'`
- Swedish: `localeSv`, `'sv'`
- Thai: `localeTh`, `'th'`
- Turkish: `localeTr`, `'tr'`
- Ukrainian: `localeUa`, `'ua'`
**Default value**: `undefined`
### monthNames
Array
The list of full month names.
**Default value**: `['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']`
### monthNamesShort
Array
The list of abbreviated month names.
**Default value**: `['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']`
### moreEventsPluralText
string
Text for the "more" label on the calendar, when there's not enough space to display all the labels for the day,
and there are more than one extra labels.
The `{count}` inside the string will be replaced with the number of extra labels.
When not specified, the [moreEventsText](#localization-moreEventsText) option will be used for both plural and singular form.
**Default value**: `undefined`
### moreEventsText
string
Text for the "more" label on the calendar, when there's not enough space to display all the labels for the day.
The `{count}` inside the string will be replaced with the number of extra labels.
Use the [moreEventsPluralText](#localization-moreEventsPluralText) as well, if the plural form is different.
**Default value**: `'{count} more'`
### newEventText
string
Title for the newly created event with the [dragToCreate](#opt-dragToCreate) and the
[clickToCreate](#opt-clickToCreate) action.
**Default value**: `'New event'`
### nextPageText
string
Text for the next button in the calendar header, used as accessibility label.
**Default value**: `'Next page'`
### pmText
string
Text for PM.
**Default value**: `'pm'`
### prevPageText
string
Text for the previous button in the calendar header, used as accessibility label.
**Default value**: `'Previous page'`
### rtl
boolean
Enables right-to-left display.
**Default value**: `false`
### timeFormat
string
The format for parsed and displayed times:
- `h` - 12 hour format (no leading zero)
- `hh` - 12 hour format (leading zero)
- `H` - 24 hour format (no leading zero)
- `HH` - 24 hour format (leading zero)
- `m` - minutes (no leading zero)
- `mm` - minutes (leading zero)
- `s` - seconds (no leading zero)
- `ss` - seconds (leading zero)
- `a` - lowercase am/pm
- `A` - uppercase AM/PM
- `'...'` - literal text
- `''` - single quote
- anything else - literal text
**Default value**: `'hh:mm A'`
### todayText
string
Text for the "Today" button.
**Default value**: `'Today'`
### Renderers
The display of the Event Calendar can be customized with different render functions.
### renderDay
(args: MbscCalendarDayData) => any
Customize the day cells of the calendar view and the date header in case of scheduler and timeline views.
If you are looking to customize only the day cells content and don't want to bother with the styling of the event,
in case of calendar and scheduler views you can use the [renderDayContent](#renderer-renderDayContent) option.
The following day specific details are available:
- `date`: _Date_ - The date of the rendered day.
- `selected`: _boolean_ - True if the date is selected (in case of the calendar view).
- `events`: _Array_ - The list of events for the day.
- `resource`: _string | number_ - The id of the resource in case of the scheduler (week and month views)
when the events are grouped by resources.
- `isActive`: _boolean_ - True for the current day (in case of the timeline view).
**Default value**: `undefined`
### renderDayContent
(args: MbscCalendarDayData) => any
Customize the day cells content of the event calendar. The Eventcalendar will take care of the styling and you can focus on
what you show beside the day number.
If you are looking to fully customize the day (e.g. add custom hover effects) you will need to use the
[renderDay](#renderer-renderDay) option.
The following properties are available:
- `date`: _Date_ - The date of the rendered day.
- `selected`: _boolean_ - True if the date is selected (in case of the calendar view).
- `events`: _Array_ - The list of events for the day.
- `resource`: _string | number_ - The id of the resource in case of the scheduler (week and month views)
when the events are grouped by resources.
**Default value**: `undefined`
### renderEvent
(data: MbscCalendarEventData) => any
Customize the events that appear on the agenda and the popover.
If you are looking to customize only the content (e.g. add custom elements) and don't want to bother with the styling of the event,
you can use the [renderEventContent](#renderer-renderEventContent) option.
Some of the event specific details are computed, but there is also a reference to the **original** event they come from.
The following event specific properties are available:
- `allDay`: _string_ - The localized all-day text in case of all day events.
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `lastDay`: _boolean_ - True if it's rendered on the last day of a multiple event.
- `original`: _MbscCalendarEvent_ - The original event object.
- `start`: _string_ - The formatted start time, if the event is not all day.
- `title`: _string_ - The title of the event.
**Default value**: `undefined`
### renderEventContent
(data: MbscCalendarEventData) => any
Customize the event content that appears on the agenda and the popover.
The Eventcalendar will take care of styling and you can focus on what you show inside of the event.
If you are looking to fully customize the event (e.g. add custom hover effects) you will need to use the
[renderEvent](#renderer-renderEvent) option.
Some of the event specific details are computed, but there is also a reference to the **original** event they come from.
The following event specific properties are available:
- `allDay`: _string_ - The localized all-day text in case of all day events.
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `lastDay`: _boolean_ - True if it's rendered on the last day of a multiple event.
- `original`: _MbscCalendarEvent_ - The original event object. Any custom property on the event can be accessed through this property.
- `start`: _string_ - The formatted start time, if the event is not all day.
- `title`: _string_ - The title of the event.
**Default value**: `undefined`
### renderHeader
() => any
Customize the header of the event calendar.
You can use custom markup and the built in header components of the calendar.
**Default value**: `undefined`
### renderLabel
(event: MbscCalendarEventData) => any
Customize the labels that appear on the calendar view.
The Eventcalendar will take care of the positioning, but everything else (like background color, hover effect, etc.) is left to you.
If you are looking to customize only the content (e.g. add custom elements) and
don't want to bother with the styling of the label, you can use the [renderLabelContent](#renderer-renderLabelContent) option.
Some of the event specific details are computed, but there is also a reference to the **original** event they come from.
The following event specific properties are available:
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `original`: _MbscCalendarEvent_ - The original event object. Any custom property on the event can be accessed through this property.
- `start`: _string_ - The formatted start time, if the event is not all day.
**Default value**: `undefined`
### renderLabelContent
(event: MbscCalendarEventData) => any
Customize the label contents, that appears on the calendar.
The Eventcalendar will take care of styling and you can focus on what you show inside of the label.
If you are looking to fully customize the label (ex. add custom hover effects) you will need to use the
[renderLabel](#renderer-renderLabel) option.
In that case you will only get the positioning done by the Eventcalendar and everything else is up to you.
Some of the event specific details are computed, but there is also a reference to the **original** event they come from.
The following event specific properties are available:
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `original`: _MbscCalendarEvent_ - The original event object. Any custom property on the event can be accessed through this property.
- `start`: _string_ - The formatted start time, if the event is not all day.
**Default value**: `undefined`
### Types
### MbscCalendarColor
Interface
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 color
- `end`: *string | object | Date* - Specifies the end date/time of a date/time range for the color
- `highlight`: *string* - Highlight color of the day, can be any valid CSS color (`'red'`, `'#ff0000'`, `'rgb(255, 0, 0)'`, etc.).
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring days.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Exception rule of the recurring rule.
Useful when recurring dates need to be skipped from the rule.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 color
- `textColor`: *string* - A color applied on the text.
- `title`: *string* - A title that will be displayed on the item.
### MbscCalendarEvent
Interface
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 event
- `cssClass`: *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 event
- `dragBetweenResources`: *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 event
- `id`: *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 the `eventOverlap`
property of the resource and the [eventOverlap](#opt-eventOverlap) option.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring events.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 the `eventResize` property of the resource and
the [dragToResize](#opt-dragToResize) option.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 event
- `textColor`: *string* - A color applied on the text.
- `timezone`: *string* - Timezone of the event
- `title`: *string* - The title of the event.
- `tooltip`: *string* - The tooltip text of the event.
### MbscCalendarInvalid
Interface
Properties:
- `allDay`: *boolean* - If true the specified invalid will cover the whole day.
- `end`: *[MbscDateType](#type-MbscDateType)* - Specifies the end of the invalid range.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Recurrence rule for recurring invalid ranges.
- `recurringException`: *[MbscDateType](#type-MbscDateType) | Array<[MbscDateType](#type-MbscDateType)>* - Specifies recurring exceptions.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence exception rule.
Useful when recurring dates need to be skipped from the rule.
- `start`: *[MbscDateType](#type-MbscDateType)* - Specifies the start of the invalid range.
### MbscCalendarLabel
Interface
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 label
- `end`: *string | object | Date* - Specifies the end date/time of a date/time range for the label
- `order`: *number* - Specifies the order of the label in the array. Has precedence over the default ordering rules.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring days.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 label
- `textColor`: *string* - A color applied on the text.
- `title`: *string* - The title of the label.
- `tooltip`: *string* - Tooltip for the label
### MbscCalendarMarked
Interface
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 applicable
- `end`: *string | object | Date* - Specifies the end date/time of a date/time range when this is applicable
- `markCssClass`: *string* - CSS class for the mark.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring days.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 applicable
- `textColor`: *string* - A color applied on the text.
- `title`: *string* - A title that will be displayed on the item.
### MbscDateType
string | Date | object
### MbscLocale
Interface
Properties:
- `allDayText`: *string*
- `amText`: *string*
- `calendarSystem`: *MbscCalendarSystem*
- `cancelText`: *string*
- `clearText`: *string*
- `closeText`: *string*
- `dateFormat`: *string*
- `dateFormatFull`: *string*
- `dateFormatLong`: *string*
- `dateText`: *string*
- `dateWheelFormat`: *string*
- `dayNames`: *Array*
- `dayNamesMin`: *Array*
- `dayNamesShort`: *Array*
- `daySuffix`: *string*
- `dayText`: *string*
- `eventText`: *string*
- `eventsText`: *string*
- `filterEmptyText`: *string*
- `filterPlaceholderText`: *string*
- `firstDay`: *number*
- `fromText`: *string*
- `hourText`: *string*
- `minuteText`: *string*
- `monthNames`: *Array*
- `monthNamesShort`: *Array*
- `monthSuffix`: *string*
- `monthText`: *string*
- `moreEventsPluralText`: *string*
- `moreEventsText`: *string*
- `nextMonthText`: *string*
- `nextYearText`: *string*
- `noEventsText`: *string*
- `nowText`: *string*
- `pmText`: *string*
- `prevMonthText`: *string*
- `prevYearText`: *string*
- `rangeEndHelp`: *string*
- `rangeEndLabel`: *string*
- `rangeStartHelp`: *string*
- `rangeStartLabel`: *string*
- `rtl`: *boolean*
- `secondText`: *string*
- `selectedPluralText`: *string*
- `selectedText`: *string*
- `setText`: *string*
- `timeFormat`: *string*
- `timeText`: *string*
- `timeWheels`: *string*
- `toText`: *string*
- `todayText`: *string*
- `weekText`: *string*
- `yearSuffix`: *string*
- `yearText`: *string*
### MbscRecurrenceRule
Interface
Properties:
- `count`: *number*
- `day`: *number | Array*
- `from`: *[MbscDateType](#type-MbscDateType)*
- `interval`: *number*
- `month`: *number | Array*
- `pos`: *number*
- `repeat`: *"daily" | "weekly" | "monthly" | "yearly"*
- `until`: *[MbscDateType](#type-MbscDateType)*
- `weekDays`: *string*
- `weekStart`: *string*
### MbscResponsiveOptions
Interface
The `MbscResponsiveOptions` supports custom properties in the form:
```
[key:string]: MbscEventcalendarOptions & {breakpoint?: number}
```
The keys are the names of the breakpoints, and the values are objects containing the options for the given breakpoint.
The `breakpoint` property, when present, specifies the min-width in pixels. The options will take into effect from that width.
:::info
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: 0px
- `small` - min-width: 576px
- `medium` - min-width: 768px
- `large` - min-width: 992px
- `xlarge` - min-width: 1200px
### MbscTimezonePlugin
Interface
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*
---
## CRUD
## Updating event properties
The Eventcalendar is bound to an array of event objects as described in the [data binding](data-binding) section. To update a single event with new event data the [`updateEvent`](./api#method-updateEvent) method can be used.
```jsx title="Updating an event title"
const myEvents = [
{ id: 'id1' start: '2023-09-24', end: '2023-09-30', title: 'Short trip!'},
// highlight-next-line
{ id: 'id2' start: '2023-10-12', end: '2023-10-12', title: 'Birthday'},
{ id: 'id3' start: '2023-12-24', end: '2023-12-26', title: 'X-mas'},
];
// intialize the eventcalendar
const inst = mobiscroll.eventcalendar('#myDiv', {
view: {
calendar: { type: "month" },
agenda: { type: "month" },
},
data: myEvents,
});
// get and update the event title property
const myEvent = myEvents.find((ev) => ev.id === 'id2');
myEvent.title = 'My Birthday';
// update the event on the eventcalendar
// highlight-next-line
inst.updateEvent(myEvent);
```
The same concept can be used to add or delete a calendar event or to update any properties of an event with incoming data, regardless where the data comes from (outside of the eventcalendar), be it an edit form or an external API.
To add an event to the eventcalendar you can use the [`addEvent`](./api#method-addEvent) method. To delete an event from the eventcalendar the [`removeEvent`](./api#method-removeEvent) method can be used. To overwrite all events with a new set of data on the eventcalendar you can use the [`setEvents`](./api#method-setEvents) method.
## Working with servers
The Eventcalendar exposes a variety of [events](api#events) that are triggered on certain actions made on calendar events. These events can be used to send your data to your API or save it to a persistent storage.
### Event create
To enable the creation of events on the Eventcalendar you can use the [`dragToCreate`](api#opt-dragToCreate) and the [`clickToCreate`](api#opt-clickToCreate) options (desktop browsers only).
When an event is about to be created using click or drag on the Eventcalendar UI, the [`onEventCreate`](api#event-onEventCreate) event is fired. If not canceled by returning `false` a temporary event is created on the Eventcalendar followed by the [`onEventCreated`](api#event-onEventCreated). Any of these two events are passed the event properties that can be used to save the event to a persistent storage or to send it through an API.
```js title="Save a new event through an API"
mobiscroll.eventcalendar('#myDiv', {
view: { schedule: { type: "week" } },
// highlight-start
onEventCreate: function (args, inst) {
const eventToSave = args.event;
$.post('/your-api', eventToSave);
}
// highlight-end
});
```
### Event update
Similar to [event creation](#event-create) above, to enable event editing you can use the [`dragToResize`](api#opt-dragToResize) and [`dragToMove`](api#opt-dragToMove) options.
When an event is about to be updated by dragging on the Eventcalendar UI, the [`onEventUpdate`](api#event-onEventUpdate) event is fired. If not canceled by returning `false` the calendar event is updated on the calendar. This update is followed by the [`onEventUpdated`](api#event-onEventUpdated). Any of these two events are passed the calendar event previous and new properties that can be used to save the event to a persistent storage or to send it through an API.
```js title="Send an updated event through an API"
mobiscroll.eventcalendar('#myDiv', {
view: { schedule: { type: "week" } },
data: [
{ id: 'id1' start: '2023-09-24', end: '2023-09-30', title: 'Short trip!'},
],
// highlight-start
onEventUpdated: function (args, inst) {
const updatedEvent = args.event;
$.post('/your-api', updatedEvent);
}
// highlight-end
});
```
:::info
When updating a recurring event from the UI (by dragging for example), the update won't affect all the occurences of the event. A single instance is updated from a set of occurences by adding an [exception to the rule](../core-concepts/recurrence#rule-exceptions) and creating another event with the changed properties.
Adding this exception to the rule is an update to the event, so the [`onEventUpdate`](./api#event-onEventUpdate) and [`onEventUpdated`](./api#event-onEventUpdated) will be fired as expected. There will also be an [`onEventCreate`](./api#event-onEventCreate) and [`onEventCreated](./api#event-onEventCreated) event fired for the changed occurence, that is not be part of the recurring set anymore.
:::
In case you would like to edit a recurring event, you can use the `updateRecurringEvent` helper function:
### updateRecurringEvent
(originalRecurringEvent: [MbscCalendarEvent](#type-MbscCalendarEvent), oldEventOccurrence: [MbscCalendarEvent](#type-MbscCalendarEvent), newEvent: [MbscCalendarEvent](#type-MbscCalendarEvent), updatedEvent: [MbscCalendarEvent](#type-MbscCalendarEvent), updateMode: "all" | "current" | "following", timezone: string, timezonePlugin: [MbscTimezonePlugin](#type-MbscTimezonePlugin)) => {newEvent: [MbscCalendarEvent](#type-MbscCalendarEvent) | null, updatedEvent: [MbscCalendarEvent](#type-MbscCalendarEvent)}
Updates a recurring event, returns the updated and the new event.
Parameters:
- originalRecurringEvent - The original event to update.
- oldEventOccurrence - The original event occurrence in case of & (what is dragged).
- newEvent - The created even in case of & (where is dragged).
- updatedEvent - The updated event from popup.
- updateMode - The update type.
### Event delete
When an event is selected on the Eventcalendar, hitting the `Delete` or `Backspace` button will delete the event.
Just before the event is deleted, the [`onEventDelete`](./api#event-onEventDelete) event is fired. Returning `false` from the `onEventDelete` will prevent the delete from happening. If not prevented, there will be an [`onEventDeleted`](./api#event-onEventDeleted) event fired and the event will be removed from the Eventcalendar.
Either one of these events can be used to send the deletion through an API.
```js title="Notify a server of an event deletion"
mobiscroll.eventcalendar('#myDiv', {
view: { schedule: { type: "week" } },
data: [
{ id: 'id1' start: '2023-09-24', end: '2023-09-30', title: 'Short trip!'},
],
// highlight-start
onEventDeleted: function (args, inst) {
const theEvent = args.event;
$.post('/your-api', theEvent);
}
// highlight-end
});
```
:::caution
When deleting a recurring event, there will not be an [`onEventDelete`](./api#event-onEventDelete) nor an [`onEventDeleted`](./api#event-onEventDeleted) event fired because the event is not deleted actually. A single instance is deleted from a set of occurences by adding an [exception to the rule](../core-concepts/recurrence#rule-exceptions).
Adding this exception to the rule is an update to the event, so the [`onEventUpdate`](./api#event-onEventUpdate) and [`onEventUpdated`](./api#event-onEventUpdated) are fired instead of the delete.
:::
---
## Data binding
{ value: 'Local Data', level: 2, id: 'local-data'},
{ value: 'Remote Data', level: 2, id: 'remote-data'},
{ value: 'On demand loading', level: 2, id: 'on-demand-loading'}
];
The Eventcalendar accepts an array of event objects through the [`data`](api#opt-data) option of the component. The event array can be either a local static array, or populated on demand with remote requests.
## Event data structure
The events of the Eventcalendar are specified as an array of event objects. The event object supports the following properties:
- `id` _String, Number_ - A unique id for the event. If not specifed, the event will get a generated id.
- `start` _Date, String, Object_ - Specifies the start of the event.
- `end` _Date, String, Object_ - Specifies the end of the event.
- `title` _String_ - The title of the event.
- `color` _String_ - The color of the event.
- `allDay` _Boolean_ - Specifies if the event is all day or not.
- `editable` _Boolean_ - specify if an event is editable or not. Setting it to false disables drag & drop, resize and delete, and the event will have the `.mbsc-readonly-event` css class. With this class, the fixed events will be easily customizable, for example: add opacity or disable the cursor on the fixed events.
- `dragBetweenResources` _Boolean_ - specifies whether the event is movable across resources. It applies for [scheduler](scheduler) and [timeline](timeline) views. Has precedence over the `eventDragBetweenResources` property of the [resource](resources) and the [`dragBetweenResources`](api#opt-dragBetweenResources) option.
- `dragInTime` _Boolean_ - specifies whether the event is movable in time. Has precedence over the `eventDragInTime` property of the [resource](resources) and the [`dragInTime`](api#opt-dragInTime) option.
- `resize` _Boolean_ - specifies whether the event is resizable. Has precedence over the `eventResize` property of the [resource](resources) and the [`dragToResize`](api#opt-dragToResize) option.
- `resource` _String, Number, Array_ - specify resource ids for the events. The event will display only in the specified [resource](resources) group. If there is no resource id defined the event will be displayed at every resource group.
- `slot` _String, Number_ - specify slot ids for the events. The event will display only in the specified [`slot`](api#opt-slots) group. If there is no slot id defined the event will be displayed at every slot group.
- `recurring` _String, Object_ - Recurrence rule for the event.
- `recurringException` _String, Object, Array_ - Represents the exceptions of a recurring event. Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule` _String, Object_ - Represents the exception rule of a recurring event. Useful when recurring dates need to be skipped from the rule.
- `timezone` _String_ - The timezone of the event. When specified, it takes precedence over [`dataTimezone`](api#opt-dataTimezone). A timezone plugin must be also passed to the component.
- `tooltip` _String_ - Specifies the tooltip text of the event.
- `cssClass` _String_ - Can be used to pass custom CSS classes on an event to event basis. Useful when customization is needed on the event level. For example: setting the width for specific events.
- `bufferBefore` _Number_ - Defines a buffer time in minutes that will be displayed before the start of the event. This buffer area can help you visualise delays or added minutes for tasks. For example travel time for meetings/appointments, briefing before flight, check in time on duty card.
- `bufferAfter` _Number_ - Defines a buffer time in minutes that will be displayed after the end of the event. This buffer area can help you visualise delays or added minutes for tasks. For example travel time after meetings/appointments, debriefing after flight, check out time on duty card.
```javascript title="Simple event object"
const myMeeting = {
start: "2023-07-14T08:00",
end: "2023-07-14T09:00",
title: "Meeting with Jenny",
};
```
:::info
The dates in the above structure can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
:::
```javascript title="Using date object in event objects"
const myBirthday = {
// highlight-next-line
start: new Date(1988, 5, 28), // 1988 June 28th
allDay: true,
recurring: {
repeat: "yearly",
},
title: "My Birthday",
};
```
:::info
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 eventcalendar, but they are kept and will be available anywhere the event objects are used. E.g. the [`onEventClick`](api#event-onEventClick) event will receive the event object as argument, containing the custom properties as well.
```javascript title="Event object with custom properties"
const weeklyMeeting = {
start: '2023-07-26T15:45',
end: '2023-07-26T16:00',
title: 'Daily summary',
// highlight-start
address: 'Main Street 64'
videoUrl: 'https://myaddress.com/location',
recipients: ['Jack', 'Sam', 'Teal`c']
// highlight-end
}
```
## Recurring events
The `recurring`, `recurringException` and `recurringExceptionRule` properties of the event object are used to define events that happen again over time. Check out the [recurrence section](../core-concepts/recurrence) for a more comprehensive description on recurring rules.
Local data
To bind local data to the event calendar, you can simply assign a JavaScript array of objects to the [`data`](api#opt-data) option of the component.
```js
mobiscroll.eventcalendar('#myDiv', {
data: [{
id: "event_id1",
start: "2023-07-09",
end: "2023-07-13",
title: "My First Event",
},
{
id: "event_id2",
start: "2023-08-01",
end: "2023-08-03",
title: "My Second Event",
}],
});
```
Remote data
You can load the data through an external request and use the [`setEvents`](./api#method-setEvents) method to update the eventcalendar with the newly received data.
```js
const inst = mobiscroll.eventcalendar('#myDiv', {
view: {
calendar: { type: "month" },
agenda: { type: "month" },
}
});
mobiscroll.getJson(
"https://trial.mobiscroll.com/events/?vers=5",
(events) => {
inst.setEvents(events);
},
"jsonp"
);
```
On demand loading
Use the [`onPageLoading`](api#event-onPageLoading) event to load the data relevant to the currently active view. The event fires every time the date range of the view changes, for example when someone navigates the event calendar. Getting the events in real time as the user interacts with the UI improves load performance and always serves the most recent data.
:::tip
You can pass the view variables - like month and year - in the URL and handle the filtering inside the API implementation.
:::
```js
mobiscroll.eventcalendar('#myDiv', {
view: {
schedule: { type: 'day' }
},
onPageLoading: function(args, inst) {
const year = args.month.getFullYear();
const month = args.month.getMonth();
const day = args.month.getDate();
mobiscroll.getJson(
'https://trial.mobiscroll.com/weeklyevents/?year=' + year + '&month=' + month + '&day=' + day,
(data) => {
inst.setEvents(data);
},
'jsonp'
);
}
});
```
In case of the timeline view, data can also be [loaded dynamically during scrolling](timeline#load-data-on-scroll). Scrolling vertically or horizontally triggers the [onVirtualLoading](#event-onVirtualLoading) lifecycle event, which can be used to [load data incrementally during scrolling](https://demo.mobiscroll.com/timeline/load-resources-on-scroll#).
---
## Drag & drop
{ value: 'Draggable', level: 3, id: 'draggable'},
{ value: 'Draggable options', level: 3, id: 'draggable-options'},
{ value: 'Third party dragging support', level: 3, id: 'third-party-dragging-support'},
{ value: 'The Eventcalendar as source', level: 2, id: 'the-eventcalendar-as-source'},
{ value: 'Dropcontainer', level: 3, id: 'dropcontainer'},
{ value: 'Dropcontainer events', level: 3, id: 'dropcontainer-events'},
{ value: 'Drop to third party drag&drop list', level: 3, id: 'third-party-dropping-support'},
];
Calendar events can be created, moved and resized on the Eventcalendar. Furthermore it is possible to drag and drop events from an external source or to drag and drop to an external target from the Eventcalendar. The following sections describe how these solutions can be implemented and used.
## Internal drag/resize/create
The events on the Eventcalendar can be moved and resized with mouse/touch interactions. The [`dragToMove`](./api#opt-dragToMove) and [`dragToResize`](./api#opt-dragToResize) options enable the events drag and drop and resize functionality. With the [`dragTimeStep`](./api#opt-dragTimeStep) option the minimum amount of drag/resize step can be specified in minutes.
With the [`dragToCreate`](./api#opt-dragToCreate) option enabled, events can be created by dragging on the empty areas of the Eventcalendar. On a desktop environment a new event can also be created with the [`clickToCreate`](./api#opt-clickToCreate) option.
To customize the newly created event use the [`extendDefaultEvent`](./api#opt-extendDefaultEvent) option.

## Targeting the Eventcalendar
There is a possibility to drag & drop any external element into your calendar.
In order to achieve this, first you need to grant permission to your calendar to accept this behavior. You can do that by setting the [`externalDrop`](./api#opt-externalDrop) option to `true`.
As a second step, you'll have to create your external draggable element and pass a skeleton event definition through the `dragData` option which will be added to the Eventcalendar on drop. If omitted, a default event will be created.
Draggable
You can initialize the draggable containers by using the `draggable()` function on the container element.
```html
My Draggable event
```
```js
mobiscroll.draggable('#myDraggableCont', {
dragData: {
title: "My new 3h long event",
start: new Date(2023, 10, 10, 12),
end: new Date(2023, 10, 10, 15),
color: "green",
}
});
mobiscroll.eventcalendar('#myDiv', {
externalDrop: true,
});
```
Draggable options
### context
string | HTMLElement
Specify where the dragged element will be appended in the DOM.
### dragData
string | [MbscCalendarEvent](#type-MbscCalendarEvent) | [MbscResource](#type-MbscResource)
The data of the dragged element.
The [`MbscCalendarEvent`](#type-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 event
- `cssClass`: *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 event
- `dragBetweenResources`: *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 event
- `id`: *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 the `eventOverlap`
property of the resource and the [eventOverlap](#opt-eventOverlap) option.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring events.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 the `eventResize` property of the resource and
the [dragToResize](#opt-dragToResize) option.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 event
- `textColor`: *string* - A color applied on the text.
- `timezone`: *string* - Timezone of the event
- `title`: *string* - The title of the event.
- `tooltip`: *string* - The tooltip text of the event.
The [`MbscResource`](#type-MbscResource) type has the following properties:
- `background`: *string* - Specifies the background color of the resource row or column.
- `children`: *Array<[MbscResource](#type-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](#opt-dragBetweenResources) option.
- `eventDragBetweenSlots`: *boolean* - Specifies whether the events in this slot are movable across slots.
Has precedence over the [dragBetweenSlots](#opt-dragBetweenSlots) option.
- `eventDragInTime`: *boolean* - Specifies whether the events in this resource are movable in time.
Has precedence over the [dragInTime](#opt-dragInTime) option.
- `eventOverlap`: *boolean* - Specifies whether the events in this resource can be overlapped.
Has precedence over the [eventOverlap](#opt-eventOverlap) option.
- `eventResize`: *boolean* - Specifies whether the events in this resource are resizable.
Has precedence over the [dragToResize](#opt-dragToResize) option.
- `fixed`: *boolean* - Specifies whether the resource is fixed to the top.
It applies for timeline view if `resolutionVertical` in [view](#opt-view) option is not given, or it's value is set to `none`.
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 if `resourceReorder` in [view](#opt-view) option is enabled.
### element
HTMLElement
The HTML element of the dragged item.
### type
"event" | "resource"
The type of the draggable element.
Third party dragging libraries
Mobiscroll comes with built-in support for two widely used reorderable drag-and-drop list libraries: [SortableJS](https://sortablejs.github.io/Sortable/) and [Dragula](https://bevacqua.github.io/dragula/). With the `sortableJsDraggable` and `dragulaDraggable` plugins, you can seamlessly drag items into the Eventcalendar with just a few lines of code.
SortableJS:
Integration: call the `sortableJsDraggable` plugin’s `init()` method and pass the SortableJS instance along with the `options` object.
The options object can include the following properties:
- `cloneSelector` - *string* - the selector of the SortableJS clone element, typically `'.sortable-drag'`
- `dragData` - *(el: HTMLElement) => MbscCalendarEvent | MbscResource* - function to build the resource or event object. Defaults to `data-drag-data` attribute on the element.
- `type` - *'event' | 'resource'* - Creates an event or resource on the Eventcalendar. Defaults to `'event'`.
- `externalDrop` - *boolean* - Enables drop from Eventcalendar to SortableJS list.
- `onExternalDrop` - *(args: {container: HTMLElement, position: number, dragData: MbscCalendarEvent | MbscResource, afterElement?: HTMLElement}) => void* - function triggered on drop from Eventcalendar to SortableJS list.
```html
Sortable appointments
Winfred Lesley - Teeth whitening
1.5 hours
Rosalin Delice - Crown and bridge
2 hours
```
```ts
mobiscroll.eventcalendar('#myDiv', {
externalDrop: true,
});
var sortableList = document.getElementById('sortable-list');
var sortableInst = Sortable.create(sortableList, {
animation: 150,
forceFallback: true,
});
mobiscroll.sortableJsDraggable.init(sortableInst, {
cloneSelector: '.sortable-drag',
});
```
:::info
The SortableJS integration works only if fallback mode is used.
The `cloneSelector` must be set in the `options` object.
:::
Dragula:
Integration: call the `dragulaDraggable` plugin’s `init()` method and pass the Dragula instance, optionally providing an `options` object to customize the behavior.
The options object can include the following properties:
- `dragData` - *(el: HTMLElement) => MbscCalendarEvent | MbscResource* - function to build the resource or event object. Defaults to `data-drag-data` attribute on the element.
- `type` - *'event' | 'resource'* - Creates an event or resource on the Eventcalendar. Defaults to `'event'`.
- `externalDrop` - *boolean* - Enables drop from Eventcalendar to Dragula list.
- `onExternalDrop` - *(args: {container: HTMLElement, position: number, dragData: MbscCalendarEvent | MbscResource, afterElement?: HTMLElement}) => void* - function triggered on drop from Eventcalendar to Dragula list.
```html
Dragula appointments
Winfred Lesley - Teeth whitening
1.5 hours
Rosalin Delice - Crown and bridge
2 hours
```
```ts
mobiscroll.eventcalendar('#myDiv', {
externalDrop: true,
});
var dragulaList = document.getElementById('dragula-list');
var drake = dragula([dragulaList], {
copy: true,
});
mobiscroll.dragulaDraggable.init(drake);
```
:::info
When using the Dragula integration on touch devices, draggable items require the following CSS rule to ensure proper behavior:
`.task {
touch-action: none;
}`
This is a known limitation in Dragula’s touch support that has not been addressed yet.
:::
The Eventcalendar as source
The [`externalDrag`](./api#opt-externalDrag) option enables events to be dragged out from the calendar/schedule/timeline views and dropped on another instance of the Eventcalendar or any [Dropcontainer](#dropcontainer).
When an event leaves the Eventcalendar the [`onEventDragLeave`](./api#event-onEventDragLeave) life-cycle event will be fired and a clone of the calendar event will be displayed for a better illustration of the movement. If the [`dragToMove`](./api#opt-dragToMove) option is not enabled the dragged event will instantly leave the calendar container and the [`onEventDragLeave`](./api#event-onEventDragLeave) event will fire and the event clone will be displayed. When an event enters the Eventcalendar the [`onEventDragEnter`](./api#event-onEventDragEnter) life-cycle event will be fired.
Dropcontainer
The Dropcontainer defines a container where events can be dragged from or dropped to. The [`onItemDragLeave`](#event-onItemDragLeave) and [`onItemDragEnter`](#event-onItemDragEnter) life-cycle events can be used to track when an event exits or enters the Dropcontainer. When an item is dropped inside the container the [`onItemDrop`](#event-onItemDrop) event is triggered. This can be useful for unscheduling work or appointments that were already scheduled.
```html
Unscheduled events:
My new 3h long event
```
```js
mobiscroll.dropcontainer('#myDropcontainer', {
onItemDrop: function(dropEvent) {
if (dropEvent.data) {
const ev = dropEvent.data;
const el = `
${ev.title}
`;
document.getElementById('myList').insertAdjacentHTML('beforeend', el);
mobiscroll.draggable('#myDrag' + ev.id, {
dragData: ev
});
}
}
});
mobiscroll.eventcalendar('#myDiv', {
externalDrop: true,
externalDrag: true,
dragToCreate: true,
dragToMove: true,
onEventCreate: function (args) {
const ev = args.event;
document.getElementById('myDrag' + ev.id).remove();
}
});
```
Dropcontainer events
### onDestroy
(args: any, inst: any) => void
Triggered when the component is destroyed.
Parameters:
- args - The event argument object.
- inst - The component instance.
### onInit
(args: any, inst: any) => void
Triggered when the component is initialized.
Parameters:
- args - The event argument object.
- inst - The component instance.
### onItemDragEnter
(args: MbscItemDragEvent) => void
Triggered when an event is dragged into the calendar/timeline/schedule view.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the drag.
- `data`: *MbscCalendarEvent | MbscResource * - The dragged data.
- `dataType`: *'event' | 'resource'* - The type of the dragged item.
### onItemDragLeave
(args: MbscItemDragEvent) => void
Triggered when an event is dragged into the calendar/timeline/schedule view.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the drag.
- `data`: *MbscCalendarEvent | MbscResource * - The dragged data.
- `dataType`: *'event' | 'resource'* - The type of the dragged item.
### onItemDrop
(args: MbscItemDragEvent) => void
Triggered when an event is dropped inside the drop container.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the drag.
- `data`: *MbscCalendarEvent | MbscResource * - The dragged data.
- `dataType`: *'event' | 'resource'* - The type of the dragged item.
Drop to third party drag&drop list
Mobiscroll comes with built-in support for dropping events and resources from the Eventcalendar to two of the most popular reordable drag and drop lists: [SortableJS](https://sortablejs.github.io/Sortable/) and [Dragula](https://bevacqua.github.io/dragula/). Unscheduling events or drag out resources can be enabled with the `sortableJsDraggable` and `dragulaDraggable` plugins.
Integration: enable dropping to third-party lists by setting `externalDrop` to `true` in the `sortableJsDraggable` or/and `dragulaDraggable` plugin’s `options` configuration and use the `onExternalDrop` callback to update the list. This function returns the following arguments:
- `afterElement` - *HTMLElement* - the list element before which the clone is dropped.
- `container` - *HTMLElement* - the list container.
- `dragData` - *MbscCalendarEvent | MbscResource* - the dragged data.
- `position` - *number* - the index where the clone is dropped.
```ts
// options object of the sortableJsDraggable or dragulaDraggable
// enable drop from Eventcalendar to Dragula or SortableJS list
externalDrop: true,
// update the list items after drop event
onExternalDrop: (args) => {
var newListItem = document.createElement('li');
newItem.className = 'my-list-item';
newItem.setAttribute( 'data-drag-data', JSON.stringify(args.dragData));
newItem.textContent = args.dragData.title;
args.container.insertBefore(newItem, args.afterElement || null);
},
```
---
## Navigating to a date and time
You can navigate to another view programatically any time, using the [`navigate`](./api#method-navigate) method.
This will navigate the calendar to the view containing 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.
When multiple days, weeks, months or years are displayed, the position of the specified date on the view (first, second, third, etc. day/week/month/year) is determined by the [`refDate`](./api#opt-refDate) option.
```js
const inst = mobiscroll.eventcalendar('#myDiv', {
data: [/*...*/],
selectedDate: new Date(2020, 2, 18)
});
inst.navigate(new Date(2020, 3, 19));
```
---
## Eventcalendar
The Eventcalendar component supports four highly configurable views: a [Calendar view](/javascript/eventcalendar/calendar), a [Scheduler with time grid](/javascript/eventcalendar/scheduler), a [Timeline](/javascript/eventcalendar/timeline) and an [Agenda view](/javascript/eventcalendar/agenda).
## Usage
The following example will create an Eventcalendar with the default options.
```js
mobiscroll.eventcalendar('#myDiv', {});
```
For many more examples - simple and complex use-cases - check out the [Eventcalendar demos](https://demo.mobiscroll.com/eventcalendar).
---
## Print
{ value: 'Printing', level: 2, id: 'printing'}];
The Print Module is an optional module, that includes styles and functions for printing. It can be installed and used with the Mobiscroll Eventcalendar.
## Installing the Print Module
When your Mobiscroll package is created with the [Download Builder](https://download.mobiscroll.com) and you have access to the Print Module, you can choose to include it in the built package. In this case you will need make sure you checked the print module before downloading the package from the download page. After installing your downloaded package, the Print Module will be available for import. In case it was downloaded with the download builder, the Print Module needs to be imported from the generated package.
When you're using the full Mobiscroll package from NPM, then you have the possibility to install the Print Module as an additional package (also from NPM). In this case, after successfully using the Mobiscroll CLI to configure the project, you will have to install the `@mobiscroll/print` package from npm. Use the following command:
```bash
npm install @mobiscroll/print
```
## Importing the Print Module
The Print Module consists of print specific styles, that need to be loaded into the document. Also, there's a JavaScript part, that needs to be imported and passed to the component via the [`modules`](./api#opt-modules) option.
#### Stylesheets
:::info
In the case of the package built by the download builder, there's no additional stylesheet. It is already bundled into the same file all the other component files are.
:::
For the NPM package, styles can be found at the `dist/css/` folder inside the package.
```javascript
// importing the css
// importing the SASS - if you are using SASS
```
#### JavaScript
The print module can be imported from the installed package and passed to the component using the [modules](./api#opt-modules) option. Here's an example:
```js
eventcalendar('#myDiv', {
modules: [print]
});
```
Web page imports
For projects whithout a script bundler and/or where the library is installed from a downloaded package instead of NPM, the print module can be references from the mobiscroll namespace. For mobiscroll packages built with the [download builder](https://download.mobiscroll.com), the print module will be bundled into the same package, so you don't have to include an additional package to your web page.
```js
mobscroll.eventcalendar('#myDiv', {
modules: [mobiscroll.print],
});
```
Printing
Printing the Eventcalendar contents can be done using the print method of the Eventcalendar [instance](../core-concepts/instance). Calling this method will create a new window containing only the Eventcalendar and will invoke the print function of the browser. After the printing is done, the window should close automatically.
:::info
When you want to include more than just the Eventcalendar in your print, you can invoke the print screen of your browser. You don't have to worry about the printing styles for the eventcalendar, they will be applied in this case as well.
:::
The new window created by the print method will include all the styles and links to stylesheets from the original page. These styles will be copied over automatically, but in case you are using relative urls, the base url of the new window might not match yours. In this case, the print method can be passed a config object, with your custom `baseUrl`, to make the relative paths work. By default, the `baseUrl` will be the original pages origin.
:::caution
Popup blockers might block the created window, so you need to disable the blocker for this method to work.
:::
```html
```
```js
const inst = eventcalendar('#myDiv', {
modules: [print],
});
document.getElementById('btn').addEventlistener('click', function() {
inst.print();
});
```
:::info
If you want to learn more about calling instance methods check out the [instance](../core-concepts/instance) section!
:::
---
## Resources
Resources can be many things, ranging from **people** through **conference rooms** to **company assets**, that need schedulig. The Eventcalendar can handle multiple resources inside a single instance.
The resource object supports the following properties:
- `background` _String_ - Specifies the background color of the resource row or column.
- `children` _Array of object_ - Array of resource objects which will render as a child of the specified resource.
- `collapsed` _Boolean_ - Defines the displayed state of the child resoruce group.
- `id` _Number, String_ - This is an id that can be referenced in the events/invalids/colors data.
- `name` _String_ - The name of the resource that will be displayed at the top of the resource column.
- `color` _String_ - The color controls the default event color of the resource. Event colors can be specified further on the event object itself. If the color is omitted the events of the resource will inherit the default calendar color.
- `fixed` _Boolean_ - Specifies whether the resource is fixed to the top. It applies for timeline view if `resolutionVertical` in [view](#opt-view) option is not given, or it's value is set to `none`.
- `eventCreation` _Boolean_ - Disables event creation on specific resources by setting it to false. It's true by default.
- `eventDragBetweenResources` _Boolean_ - Specifies whether the events in the specified resource are movable across resources. It applies for scheduler and timeline views and has precedence over [`dragBetweenResources`](api#opt-dragBetweenResources) option.
- `eventDragBetweenSlots` _Boolean_ - Specifies whether the events in this resource are movable in time. Has precedence over the [dragInTime](#opt-dragInTime) option.
- `eventDragInTime` _Boolean_ - Specifies whether the events in the specified resource are movable in time. Has precedence over the [`dragInTime`](api#opt-dragInTime) option.
- `eventOverlap` _Boolean_ - Specifies whether the events in this resource can be overlapped. Has precedence over the [eventOverlap](#opt-eventOverlap) option.
- `eventResize` _Boolean_ - Specifies whether the events in the specified resource are resizable. Has precedence over [`dragToResize`](api#opt-dragToResize) option.
- `reorder` _Boolean_ - Specifies whether the resource can be dragged and reordered. It applies for timeline view if `resourceReorder` in [view](#opt-view) option is enabled. Has precedence over the `resourceReorder` property.
Besides the base properties you can add any custom property, like title, job, etc.
```javascript title="Defining resources"
const myResources = [
{ id: "my_id_1", name: "Jane", job: "Developer" },
{ id: "my_id_2", name: "Bob", job: "Administrator" },
{ id: "my_id_3", name: "Andy", job: "Designer" },
];
```
:::tip
For more information on resource grouping and hierarchy check out the [timeline's](timeline#resource-grouping-and-hierarchy) or the [scheduler's](scheduler#resource-grouping) sections for resources.
:::
[Events](api#opt-data), [colors](api#opt-colors), [invalids](api#opt-invalid) can be tied to a single or multiple resources. This can be done with the `resource` property of the objects, where the id of the resource should be passed. It can be a single value and the element would be linked to a single resource or in case of an array the element will show up at the specified resources. If no resource property is specified to the color/event/invalid object then the element will show up in every resource group.
```javascript title="Invalid rule for specific resources"
const myResources = [
{ id: 1, name: 'General Courier'},
// highlight-start
{ id: 2, name: 'Express Courier'},
{ id: 3, name: 'Super Express Courier'},
// highlight-end
];
const myInvalid = [
{
// highlight-next-line
resource: [2, 3]
// is unavailable at weekends:
recurring: {
repeat: 'weekly',
weekDays: 'SU,SA',
interval: 1
}
}
];
```
:::tip
Check out the [recurrence section](../core-concepts/recurrence) for more details on recurring rules
:::
---
## Scheduler
Use the [Scheduler view](https://demo.mobiscroll.com/scheduler) which features a time grid - vertically scrollable [daily, weekly and monthly views](https://demo.mobiscroll.com/scheduler/show-hide-hours-days) with built in [resource support](https://demo.mobiscroll.com/scheduler/resource-view), [templating](#templating) and more.
## Overview
The Scheduler displays a time grid with its related events. It can be configured as a [daily, weekly or monthly schedule](https://demo.mobiscroll.com/scheduler/show-hide-hours-days). [Work hours and work days](https://demo.mobiscroll.com/scheduler/work-week-hours) along with [disabled time-spans, breaks](https://demo.mobiscroll.com/scheduler/time-off-blocked-ranges) can be added. Use it for [advanced scheduling tasks](https://demo.mobiscroll.com/scheduler/doctors-appointment) with built-in drag & drop.
The capabilities like [recurring events](/javascript/core-concepts/recurrence), [all-day, multi-day events](#opt-data), [responsiveness](#responsiveness) are supported by the Scheduler.

## Showing the Scheduler
### View combination
The four views - [scheduler](./scheduler), [calendar](./calendar), [timeline](./timeline), [agenda](./agenda) - can be used alone or combined with each-other to create the perfect user experience on mobile, desktop and on everything in-between.
For example, the daily Scheduler can also be combined with the Calendar week view. The view option will look like the following:
```javascript title="Daily Scheduler combined with Weekly Calendar"
mobiscroll.eventcalendar('#scheduler', {
view: {
calendar: {
type: 'week'
},
schedule: {
type: 'day'
}
}
});
```
### Configuring the view
The Scheduler view can be configured through the `view` option. Below are listed the `schedule` object properties which can help you fine-tune this view.
```javascript title='Example'
mobiscroll.eventcalendar('#scheduler', {
view: {
schedule: {
type: 'week',
startDay: 1,
endDay: 5,
startTime: '09:00',
endTime: '17:00',
timeCellStep: 60,
timeLabelStep: 60,
currentTimeIndicator: true
}
}
});
```
### allDay
boolean
Show or hide the all day events.
**Default value**: `true`
### currentTimeIndicator
boolean
Show or hide the current time indicator.
It defaults to `true` when the resolution is less than a day otherwise defaults to `false`.
### days
boolean
Show or hide week days above the schedule grid.
**Default value**: `true`
### endDay
number
Specifies the last visible weekday of the view. Sunday is 0, Monday is 1, etc.
Days outside of the `startDay` and `endDay` range will not be visible.
**Default value**: `6`
### endTime
string
Set the end time of scheduler column.
Hours and minutes can be specified in the same string, example: `'18:30'`.
**Default value**: `'24:00'`
### hideEmptyColumns
boolean
Hide the empty columns.
**Default value**: `false.`
### hideInvalidColumns
boolean
Hide the fully invalid columns.
**Default value**: `false.`
### maxEventStack
number | "all" | "auto"
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 the `minEventWidth` view option and the actual column width.
**Default value**: `'all'`
### minEventWidth
number
Specifies the minimum event width. Will be used when `maxEventStack: 'auto'` is used.
### size
number
Specifies the number of displayed months, weeks or days.
**Default value**: `1`
### startDay
number
Specifies the first visible weekday of the view. Sunday is 0, Monday is 1, etc.
Days outside of the `startDay` and `endDay` range will not be visible.
Should not be mistaken for the [firstDay](#localization-firstDay) option,
which sets the first day of the week, and, if not set, is defined by the [localization](#localization-locale).
**Default value**: `0`
### startTime
string
Set the start time of scheduler column.
Hours and minutes can be specified in the same string, example: `'09:30'`.
**Default value**: `'00:00'`
### timeCellStep
number
Specifies the step of the grid cells in minutes.
Supported values: 1, 5, 10, 15, 20, 30, 60, 120, 180, 240, 360, 480, 720, 1440
**Default value**: `60`
### timeLabelStep
number
Specifies the step of the time labels in minutes.
Supported values: 1, 5, 10, 15, 20, 30, 60, 120, 180, 240, 360, 480, 720, 1440.
**Default value**: `60`
### timezones
Array
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](https://gist.github.com/aviflax/a4093965be1cd008f172).
If no label is provided, the time column label will be UTC +/- the timezone offset.
```js
timezones: ['Europe/Berlin','Europe/Bucharest']
```
```js
timezones: [
{ timezone: 'America/Chicago', label: 'CHI'},
{ timezone: 'America/New_York', label: 'NY'}
]
```
### type
"day" | "month" | "week"
Sets the scheduler type.
**Default value**: `'week'`
### Row height
There might be cases when you would like to change the height of the schedule cell. You can use the following CSS classes for this purpose:
```css
.mbsc-schedule-time-wrapper,
.mbsc-schedule-item {
height: 20px;
}
```
### Column width
CSS classes offer the flexibility to adjust column widths, allowing you to fully customize the layout of both resource columns and day columns.
You can choose to customize them together or separately, giving you the freedom to create a design that suits your specific needs.
```css title="Setting general column width"
.mbsc-schedule-col-width {
width: 100px;
}
```
#### Customizing weekday column widths
Each weekday column has a predefined CSS class that allows setting different widths for them:
- `.mbsc-schedule-column-mon` (Monday)
- `.mbsc-schedule-column-tue` (Tuesday)
- `.mbsc-schedule-column-wed` (Wednesday)
- `.mbsc-schedule-column-thu` (Thursday)
- `.mbsc-schedule-column-fri` (Friday)
- `.mbsc-schedule-column-sat` (Saturday)
- `.mbsc-schedule-column-sun` (Sunday)
```css title="Adjusting width for Monday"
.mbsc-schedule-column-mon {
width: 150px;
}
```
#### Customizing resource column widths
Resource column widths can be adjusted by assigning a custom CSS class to resources using the cssClass property.
Check out how to change resource column widths in [this example](https://demo.mobiscroll.com/scheduler/content-dependent-resource-width).
```ts title="Assigning a class to a resource"
resources: [
{ id: 1, name: 'Resource 1', cssClass: 'resource-column-small' },
{ id: 2, name: 'Resource 2', cssClass: 'resource-column-large' }
]
```
```css title="Define styles for the resource classes"
.resource-column-small {
width: 80px;
}
.resource-column-large {
width: 160px;
}
```
:::info
If you override both resource and day column widths, make sure column groups (day or resource, depending on the [`groupBy`](#opt-groupBy) option)
are wide enough to contain their child elements, or specify a `min-width` for the group column instead of a fixed width.
:::
### Hide empty columns
Columns without any events can be hidden by setting `hideEmptyColumns` to `true` under the [view](#configuring-the-view) configuration.
### Hide invalid columns
Fully invalid columns can be hidden by setting `hideInvalidColumns` to `true` under the [view](#configuring-the-view) configuration.
:::info
A column is considered fully invalid if it contains [invalid](#opt-invalid) periods defined with `allDay`, date values,
or a single time range that covers a full day or multiple days.
:::
## Resources
### Resource grouping
The Scheduler view can display multiple [resources](resources) inside a single instance. By default the displayed resources will be grouped by the given resources and the grouping can be changed with the [`groupBy`](#opt-groupBy) option, which also supports grouping by date.
```javascript title="Grouping resources by date"
mobiscroll.eventcalendar('#scheduler', {
// highlight-next-line
groupBy: 'date',
resources: [{
id: 1,
name: 'Ryan',
color: '#f7c4b4'
}, {
id: 2,
name: 'Kate',
color: '#c6f1c9'
}, {
id: 3,
name: 'John',
color: '#e8d0ef'
}]
});
```
The color property controls the default event color of the resource. If an event doesn't have a specified color it will inherit from the resource. The [agenda](agenda) and [calendar view](calendar) events and labels will also inherit the resource color.
[Events](#opt-data), [colors](#opt-colors), [invalids](#opt-invalids) can be tied to a single or multiple resources. This can be done with the `resource` property of the objects, where the id of the resource should be passed. It can be a single value where the element would be linked to a single resource or in case of an array the element will show up at all of the specified resources. If no resource property is specified to the color/event/invalid object then the element will show up in every resource group.
```javascript title="Invalid rule tied to a single resource"
mobiscroll.eventcalendar('#scheduler', {
invalid: [{
// highlight-next-line
resource: 1, // this invalid will be displayed only in resource group where id is 1
start: '13:00',
end: '12:00',
recurring: { repeat: 'weekly', weekDays: 'MO,TU,WE,TH,FR' },
title: 'Lunch break'
}]
});
```
```javascript title="Event tied to multiple resources"
mobiscroll.eventcalendar('#scheduler', {
data: [{
// highlight-next-line
resource: [2, 3] // this event will be displayed in resource groups where id is 2 and 3
start: new Date(2021, 5, 23),
end: new Date(2021, 5, 30),
title: 'Conference',
allDay: true,
}]
});
```
```javascript title="Color rule for all the resources (resource not specified)"
mobiscroll.eventcalendar('#scheduler', {
colors: [{
// highlight-next-line
// this color will display at every resource group
start: new Date(2021, 5, 12, 16),
end: new Date(2021, 5, 12, 17),
color: "green",
}]
});
```
### Resource order
The initial order in which the resources appear on the scheduler follows the order of the array passed to the component. If the initial order needs to be changed, sort the resource array before passing it to the event calendar.
For dynamic sorting during runtime, sort the resource array and pass the updated array to the calendar.
## Responsiveness
The Scheduler is [fully responsive](https://demo.mobiscroll.com/scheduler/responsive-day-week-schedule#). It adapts to the available space and fills the screen to look good everywhere. While you don't have to worry about the width the height can be manually adjusted with the [height](#opt-height) option. This 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.
Use the [responsive](#opt-responsive) option to configure how the calendar behaves on different sized screens.
The responsive option is equipped with five breakpoints:
- `xsmall` (up to 575px),
- `small` (up to 767px),
- `medium` (up to 991px),
- `large` (up to 1199px),
- `xlarge` (from 1200px).
Also, custom breakpoints can be added if necessary:
- `my-custom-breakpoint: { breakpoint: 600 }` (from 600px up to the next breakpoint).
:::info
The available width is queried from the container element of the component and not the browsers viewport like in css media queries.
:::
```javascript title='Responsive configuration with the view option'
mobiscroll.eventcalendar('#scheduler', {
responsive: {
xsmall: {
view: { schedule: { type: 'day' }}
},
custom: { // Custom breakpoint, you can use multiple if needed, but each must have a unique name.
breakpoint: 600,
view: { schedule: { type: 'week' }}
}
}
});
```

## Templating
The display of Scheduler can be customized with different [render functions](#renderers).
### The cell
Use the [renderCell](#renderer-renderCell) option to fully customize the Scheduler cells. Customize how the cell look and what they show. The renderer function gets an object with properties like date, events, colors, invalids, and resource, which can be used to display custom content.
:::info
Since cells are rendered frequently while scrolling, keep the customization lightweight for best performance.
:::
Check out how you can style the cell in [this example](https://demo.mobiscroll.com/scheduler/cell-content-template#) or just play with the slider below to see the differences.
### The event, their content and buffer areas
The events can be customized in two ways:
- You can use the [renderScheduleEvent](#renderer-renderScheduleEvent) option to customize the events that appear on the Scheduler. It should return the markup of the event. The Eventcalendar will take care of the positioning, but anything else you want to show is up to you - like a title, description, color the background or show any content.
- If you are looking to customize only the content and don't want to bother with the styling of the event, you can use the [renderScheduleEventContent](#renderer-renderScheduleEventContent) option. Mobiscroll will position the event to the right place and will render essential information like the color of the event, the time and if it's an all day event or not. The title, description and any other fields you want to show (like participants or an avatar) will be coming from your custom function.
The buffers can be customized through the [renderBufferBefore](#renderer-renderBufferBefore) and [renderBufferAfter](#renderer-renderBufferAfter) options. These can help you visualise delays or added minutes for tasks. For example travel time for meetings/appointments, check in/check out for flights.
Check out how you can style event, their content and buffer areas in [this example](https://demo.mobiscroll.com/scheduler/customizing-events#) or just play with the slider below to see the differences.
### The date header
There are two approaches you can take:
- Customize the date headers of the Scheduler with the [renderDay](#renderer-renderDay) option by adding relevant content, labels or completely change how they look. It takes a function that should return the desired markup. The Eventcalendar will take care of the positioning, but everything else (like background color, hover effect, etc.) is left to you. The render function will receive an object as parameter. This data can be used to show day specific things on the Scheduler.
- If you are looking to customize only the content and don't want to bother with the styling of the event, you can use the [renderDayContent](#renderer-renderDayContent) option. You will get the styling taken care of by the Eventcalendar, and you can focus on what you show besides the day number. The template will receive an object as data. This data can be used to show day specific things on the Scheduler.
Check out how you can style the date header in [this example](https://demo.mobiscroll.com/scheduler/date-header-template#) or just play with the slider below to see the differences.
### The resource header
Use the [renderResource](#renderer-renderResource) option to customize the resource template of the Scheduler. Customize how the resource headers look and what they show. Utilize properties passed in the [resources](#opt-resources) array. It takes a function that should return the desired markup. In the returned markup, you can use custom html as well.
Check out how you can style the resources in [this example](https://demo.mobiscroll.com/scheduler/custom-resource-header-template#) or just play with the slider below to see the differences.
### The scheduler header
Customize how the header of the Scheduler looks and how the components are arranged with the [renderHeader](#renderer-renderHeader) option. It takes a function that should return the desired markup. In the returned markup, you can use custom html as well as the built in header components of the calendar.
While fully customizing the header is very usefull, sometimes it's desireable to customize only parts of it. In this case you can take advantage of the default header's [building blocks](/javascript/eventcalendar/templating#header-templating). These components let you put toghether the header you want, while you don't have to worry about the functionality behind them.
Check out how you can style the Scheduler header in [this example](https://demo.mobiscroll.com/scheduler/customizing-header#) or just play with the slider below to see the differences.
## Event order
The rendered event order is determined by the following two concepts:
1. Event data order
2. Event layout
The combination of these concepts results in the final rendered event order.
### Event data order
The sequence in which events are processed before being passed to the layout algorithm. The default ordering rules are as follows:
1. All-day events are placed at the top.
2. Non-all-day events follow, sorted by their start times.
3. Events with the same start time are further ordered alphabetically by their titles.
This default order can be modified using the `order` property in the event [event data](#opt-data). The order property takes precedence over the default rules. If two events have the same order value, the default rules apply. For more complex ordering requirements, the [eventOrder](#opt-eventOrder) option can be used. This option accepts a function that compares two events and returns an order (-1 or 1).
### Event layout
The event layout process determines the visual positioning and dimensions of events. This is a built-in functionality and cannot be altered externally. The layout algorithm processes the sorted event list and calculates each event's position and size. The algorithm follows these steps:
1. The first event is placed in the first position of the event track.
2. If two or more events overlap in their start/end times, the later event is placed in the next event track, positioned below or next to the previous event.
3. If a subsequent event does not overlap with any already added events, it is placed back in the first event track.
4. This process continues until all events are positioned within their respective columns or rows.
## API
Here is a comprehensive list of all the specific options, events and methods of the Scheduler view.
### Options
Explore the following API options that help you easily configure the Scheduler.
### 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](#opt-dragToCreate) option.
Using the [extendDefaultEvent](#opt-extendDefaultEvent) option extra properties can be set for the created event.
The event deletion functionality can be overwritten using the [eventDelete](#opt-eventDelete) option.
**Default value**: `undefined`
### colors
Array<[MbscCalendarColor](#type-MbscCalendarColor)>
Specifies the color for certain dates or date ranges on the calendar.
The [`MbscCalendarColor`](#type-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 color
- `end`: *string | object | Date* - Specifies the end date/time of a date/time range for the color
- `highlight`: *string* - Highlight color of the day, can be any valid CSS color (`'red'`, `'#ff0000'`, `'rgb(255, 0, 0)'`, etc.).
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring days.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Exception rule of the recurring rule.
Useful when recurring dates need to be skipped from the rule.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 color
- `textColor`: *string* - A color applied on the text.
- `title`: *string* - A title that will be displayed on the item.
:::info
The colored range will be considered all-day if:
- the `allDay` property is explicitly set.
- the `start` / `end` properties are not specified, only the `date`.
:::
:::info
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
:::
:::info
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
:::
:::info
The colors can be combined with the [labels](#opt-labels) or [marked](#opt-marked) options.
:::
```js
[
{ 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`
### 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](#type-MbscCalendarEvent)>
The events for the Eventcalendar.
The [`MbscCalendarEvent`](#type-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 event
- `cssClass`: *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 event
- `dragBetweenResources`: *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 event
- `id`: *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 the `eventOverlap`
property of the resource and the [eventOverlap](#opt-eventOverlap) option.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring events.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 the `eventResize` property of the resource and
the [dragToResize](#opt-dragToResize) option.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 event
- `textColor`: *string* - A color applied on the text.
- `timezone`: *string* - Timezone of the event
- `title`: *string* - The title of the event.
- `tooltip`: *string* - The tooltip text of the event.
:::info
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
:::
:::info
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
:::
:::info
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-onEventClick) event will receive the event object as argument, containing the custom properties as well.
:::
:::info
Use the [getEvents](#method-getEvents) method to get the events between two dates.
:::
```js
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.
:::info
When using timezones, the [exclusiveEndDates](#opt-exclusiveEndDates) option is also turned on by default.
:::
:::info
When using anything other than the default (`'local'`), a [timezone plugin](#opt-timezonePlugin)
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](https://gist.github.com/aviflax/a4093965be1cd008f172), e.g. `"America/New_York"`.
If not specified, it defaults to the [displayTimezone](#opt-displayTimezone).
**Default value**: `undefined`
### defaultSelectedDate
[MbscDateType](#type-MbscDateType)
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.
:::info
When using timezones, the [exclusiveEndDates](#opt-exclusiveEndDates) option is also turned on by default.
:::
:::info
When using anything other than the default (`'local'`), a [timezone plugin](#opt-timezonePlugin)
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](https://gist.github.com/aviflax/a4093965be1cd008f172), 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](#opt-dragInTime) option.
Consider that [dragToMove](#opt-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](#opt-dragBetweenResources) option.
Consider that [dragToMove](#opt-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](#opt-newEventText) option.
Using the [extendDefaultEvent](#opt-extendDefaultEvent) option extra properties can be set for the created event.
The event deletion functionality can be overwritten using the [eventDelete](#opt-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](#opt-clickToCreate) and [dragToCreate](#opt-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](#type-MbscCalendarEvent), event2: [MbscCalendarEvent](#type-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.
:::info
When using timezones, the `exclusiveEndDates` option will default to `true`.
:::
### extendDefaultEvent
(args: MbscNewEventData) => void | [MbscCalendarEvent](#type-MbscCalendarEvent)
Use this option to set properties to the new event created with click or drag.
The event creation is handled by the [clickToCreate](#opt-clickToCreate) and [dragToCreate](#opt-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.
```js
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`
### groupBy
"resource" | "date"
Groups the [events](#opt-data) by date or by [resource](#opt-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](#type-MbscDateType)> | Array<[MbscCalendarInvalid](#type-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* - 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* - Specifies the [resource](#opt-resources) 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](#opt-slots) 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.
:::info
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
:::
:::info
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
:::
```js
[
// 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-MbscCalendarInvalid) type has the following properties:
- `allDay`: *boolean* - If true the specified invalid will cover the whole day.
- `end`: *[MbscDateType](#type-MbscDateType)* - Specifies the end of the invalid range.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Recurrence rule for recurring invalid ranges.
- `recurringException`: *[MbscDateType](#type-MbscDateType) | Array<[MbscDateType](#type-MbscDateType)>* - Specifies recurring exceptions.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence exception rule.
Useful when recurring dates need to be skipped from the rule.
- `start`: *[MbscDateType](#type-MbscDateType)* - Specifies the start of the invalid range.
### invalidateEvent
"strict" | "start-end"
Specifies how to validate events against [invalid](#opt-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'`
### max
[MbscDateType](#type-MbscDateType)
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](#opt-invalid) option with daily recurrence starting from the specific date.
**Default value**: `undefined`
### min
[MbscDateType](#type-MbscDateType)
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](#opt-invalid) option with daily recurrence until the specific date.
**Default value**: `undefined`
### modules
Array
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.
```js
// import the print module
// later on, add it to the modules array:
modules: [print]
```
### refDate
[MbscDateType](#type-MbscDateType)
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](#opt-selectedDate) option.
**Default value**: `undefined`
### resources
Array<[MbscResource](#type-MbscResource)>
The scheduler and timeline views can handle multiple resources.
Resource grouping can be modified with the help of the [groupBy](#opt-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-MbscResource) type has the following properties:
- `background`: *string* - Specifies the background color of the resource row or column.
- `children`: *Array<[MbscResource](#type-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](#opt-dragBetweenResources) option.
- `eventDragBetweenSlots`: *boolean* - Specifies whether the events in this slot are movable across slots.
Has precedence over the [dragBetweenSlots](#opt-dragBetweenSlots) option.
- `eventDragInTime`: *boolean* - Specifies whether the events in this resource are movable in time.
Has precedence over the [dragInTime](#opt-dragInTime) option.
- `eventOverlap`: *boolean* - Specifies whether the events in this resource can be overlapped.
Has precedence over the [eventOverlap](#opt-eventOverlap) option.
- `eventResize`: *boolean* - Specifies whether the events in this resource are resizable.
Has precedence over the [dragToResize](#opt-dragToResize) option.
- `fixed`: *boolean* - Specifies whether the resource is fixed to the top.
It applies for timeline view if `resolutionVertical` in [view](#opt-view) option is not given, or it's value is set to `none`.
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 if `resourceReorder` in [view](#opt-view) option is enabled.
```js
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](#type-MbscResponsiveOptions)
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.
:::info
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: 0px
- `small` - min-width: 576px
- `medium` - min-width: 768px
- `large` - min-width: 992px
- `xlarge` - 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
[MbscDateType](#type-MbscDateType)
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](#opt-refDate) option.
You also need to pass a handler for the [onSelectedDateChange](#event-onSelectedDateChange) event
to update the selected date when the date is changed from the calendar.
**Default value**: `undefined`
### selectedEvents
Array<[MbscCalendarEvent](#type-MbscCalendarEvent)>
Specifies the selected events on the calendar. The [onSelectedEventsChange](#event-onSelectedEventsChange) event will be
fired when the selected events change from the calendar.
The [`MbscCalendarEvent`](#type-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 event
- `cssClass`: *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 event
- `dragBetweenResources`: *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 event
- `id`: *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 the `eventOverlap`
property of the resource and the [eventOverlap](#opt-eventOverlap) option.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring events.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 the `eventResize` property of the resource and
the [dragToResize](#opt-dragToResize) option.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 event
- `textColor`: *string* - A color applied on the text.
- `timezone`: *string* - Timezone of the event
- `title`: *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](#opt-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`
### 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](../theming/sass-variables) or
[create custom themes](../theming/sass-themes).
:::info
Make sure that the theme you set is included in the downloaded package.
:::
**Default value**: `undefined`
### themeVariant
"auto" | "light" | "dark"
Controls which variant of the [theme](#opt-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'` or `undefined` - 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
[MbscTimezonePlugin](#type-MbscTimezonePlugin)
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](https://momentjs.com/timezone/)
and [luxon](https://moment.github.io/luxon/#/).
You can specify either the [dataTimezone](#opt-dataTimezone) or the [displayTimezone](#opt-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-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* -
### width
string | number
Sets the width of the component.
**Default value**: `undefined`
### Events
The Scheduler 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.
### onCellClick
(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* - The events for the clicked date.
- `resource`: *string | number* - The id of the resource where the cell was clicked, if [resources](#opt-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.
### onCellDoubleClick
(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* - The events for the clicked date.
- `resource`: *string | number* - The id of the resource where the cell was clicked, if [resources](#opt-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.
### onCellHoverIn
(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* - The colors for the hovered cell.
- `date`: *Date* - The date of the hovered day.
- `events`: *Array* - The events for the hovered cell.
- `invalids`: *Array* - The invalid dates for the hovered cell.
- `labels`: *Array* - If the cell has labels, contains the label objects for the hovered cell.
- `marked`: *Array* - 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.
### onCellHoverOut
(args: MbscCellHoverEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer leaves a day on the calendar view (does not apply for agenda view).
Parameters:
- args - The event argument with the following properties:
- `colors`: *Array* - The colors for the hovered cell.
- `date`: *Date* - The date of the hovered cell.
- `events`: *Array* - The events for the hovered cell.
- `invalids`: *Array* - The invalid dates for the hovered cell.
- `labels`: *Array* - If the cell has labels, contains the label objects for the hovered cell.
- `marked`: *Array* - 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.
### onCellRightClick
(args: MbscCellClickEvent, inst: EventcalendarBase) => void
Triggered when a cell is right-clicked on the calendar, scheduler, or timeline grid .
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* - The events for the clicked date.
- `resource`: *string | number* - The id of the resource where the cell was clicked, if [resources](#opt-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.
### onDestroy
(args: any, inst: any) => void
Triggered when the component is destroyed.
Parameters:
- args - The event argument object.
- inst - The component instance.
### onEventClick
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when an event is clicked.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was clicked.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the click.
- `event`: *MbscCalendarEvent* - The clicked calendar event.
- `resource`: *string | number* - The id of the resource where the event was clicked, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was clicked, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was clicked, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was clicked, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was clicked.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventCreate
(args: MbscEventCreateEvent, inst: EventcalendarBase) => void
Triggered when an event is about to create and it is not yet rendered on its final position.
Event creation can be prevented by returning `false` from the handler function.
Parameters:
- args - The event argument with the following properties:
- `action`: *'click' | 'drag' | 'externalDrop'* - The action which created the event.
- `domEvent`: *Event* - The DOM event from the end of the gesture (mouseup or touchend).
- `event`: *MbscCalendarEvent* - The newly created event.
- `originEvent`: *MbscCalendarEvent* - The occurrence of the event which was dragged.
Will be set only if the event was created by dragging a recurring event occurrence.
- `resourceObj`: *MbscResource* - The resource where the event is being created, if [resources](#opt-resources) are set.
- `slotObj`: *MbscSlot* - The slot where the event is being created, if [slots](#opt-slots) are set.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event is being created.
- inst - The component instance.
### onEventCreateFailed
(args: MbscEventCreateFailedEvent, inst: EventcalendarBase) => void
Triggered when an event creation failed due to overlapping an invalid range or another event.
Parameters:
- args - The event argument with the following properties:
- `action`: *'click' | 'drag' | 'externalDrop'* - The action which created the event.
- `event`: *MbscCalendarEvent* - The newly created event.
- `invalid`: *object* - The invalid object which the event overlapped.
- `overlap`: *MbscCalendarEvent* - The overlapped event.
- `originEvent`: *MbscCalendarEvent* - The occurrence of the event which was dragged.
Will be set only if the event was created by dragging a recurring event occurrence.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event was created.
- inst - The component instance.
### onEventCreated
(args: MbscEventCreatedEvent, inst: EventcalendarBase) => void
Triggered when an event is created and it is rendered in its position.
Parameters:
- args - The event argument with the following properties:
- `action`: *'click' | 'drag' | 'externalDrop'* - The action which created the event.
- `event`: *MbscCalendarEvent* - The newly created event.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event was created.
- `target`: *HTMLElement* - The DOM element of the created event.
- `resourceObj`: *MbscResource* - The resource where the event is being created, if [resources](#opt-resources) are set.
- `slotObj`: *MbscSlot* - The slot where the event is being created, if [slots](#opt-slots) are set.
- inst - The component instance.
### onEventDelete
(args: MbscEventDeleteEvent, inst: EventcalendarBase) => void
Triggered when an event is about to be deleted and it is not yet removed from the view.
Event deletion can be performed with delete and backspace button on an active event.
Deletion can be prevented by returning `false` from the handler function.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event from of the keydown action.
- `event`: *MbscCalendarEvent* - The event being deleted.
- `events`: *Array* - The events being deleted in case of multiple event selection.
- `source`: *'agenda' | 'calendar' | 'timeline' | 'schedule'* - The view where the event is being deleted.
- inst - The component instance.
### onEventDeleted
(args: MbscEventDeletedEvent, inst: EventcalendarBase) => void
Triggered when an event is deleted and it is removed from the view.
Parameters:
- args - The event argument with the following properties:
- `event`: *MbscCalendarEvent* - The deleted event.
- `events`: *Array* - The deleted events in case of multiple event selection.
- `source`: *'agenda' | 'calendar' | 'timeline' | 'schedule'* - The view where the event was deleted.
- inst - The component instance.
### onEventDoubleClick
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when an event is double-clicked.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was clicked.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the click.
- `event`: *MbscCalendarEvent* - The clicked calendar event.
- `resource`: *string | number* - The id of the resource where the event was clicked, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was clicked, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was clicker, if [slots](#opt-slots) are set.
- `slotObj`: *MbscResource* - The resource where the event was clicker, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was clicked.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventDragEnd
(args: MbscEventDragEvent, inst: EventcalendarBase) => void
Triggered when an event drag has ended.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the drag.
- `event`: *MbscCalendarEvent* - The dragged calendar event.
- `resource`: *string | number* - The id of the resource where the event was dragged, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was dragged, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was dragged, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was dragged, if [slots](#opt-slots) are set.
- `source`: *'calendar' | 'schedule' | 'timeline'* - The view where the event was dragged.
- inst - The component instance.
### onEventDragEnter
(args: MbscEventDragEvent) => void
Triggered when an event is dragged into the calendar/timeline/schedule view.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the drag.
- `event`: *MbscCalendarEvent* - The dragged calendar event.
- `source`: *'calendar' | 'schedule' | 'timeline'* - The view where the event is dragged.
### onEventDragLeave
(args: MbscEventDragEvent) => void
Triggered when an event is dragged out form the calendar/timeline/schedule view.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the drag.
- `event`: *MbscCalendarEvent* - The dragged calendar event.
- `source`: *'calendar' | 'schedule' | 'timeline'* - The view where the event is dragged.
### onEventDragStart
(args: MbscEventDragEvent, inst: EventcalendarBase) => void
Triggered when an event drag has started.
Parameters:
- args - The event argument with the following properties:
- `action`: *'create' | 'resize' | 'move'* - The user action which triggered the event.
- `domEvent`: *Event* - The DOM event of the drag.
- `event`: *MbscCalendarEvent* - The dragged calendar event.
- `resource`: *string | number* - The id of the resource where the event is dragged, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event is dragged, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event is dragged, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event is dragged, if [slots](#opt-slots) are set.
- `source`: *'calendar' | 'schedule' | 'timeline'* - The view where the event is dragged.
- inst - The component instance.
### onEventHoverIn
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer hovers an event on the calendar.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event is hovered.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the hover.
- `event`: *MbscCalendarEvent* - The hovered calendar event.
- `resource`: *string | number* - The id of the resource where the event is hovered, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event is hovered, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event is hovered, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event is hovered, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event is hovered.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventHoverOut
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer leaves an event on the calendar.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was hovered.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the hover.
- `event`: *MbscCalendarEvent* - The hovered calendar event.
- `resource`: *string | number* - The id of the resource where the event was hovered, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was hovered, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was hovered, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was hovered, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was hovered.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventRightClick
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when an event is right-clicked.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was clicked.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the click.
- `event`: *MbscCalendarEvent* - The clicked calendar event.
- `resource`: *string | number* - The id of the resource where the event was clicked, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was clicked, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was clicked, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was clicked, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was clicked.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventUpdate
(args: MbscEventUpdateEvent, inst: EventcalendarBase) => void
Triggered when an event is about to update. Update can be prevented by returning `false` from the handler function.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event from the end of the gesture (mouseup or touchend).
- `event`: *MbscCalendarEvent* - The updated event.
- `events`: *Array* - The updated events.
It is set on recurring event delete, when [multiple event selection](#opt-selectMultipleEvents) is enabled.
- `newEvent`: *MbscCalendarEvent* - The newly created event.
Will be set only if the dragged event was a recurring event occurrence.
- `oldEvent`: *MbscCalendarEvent* - The original event before the update.
- `oldEvents`: *Array* - The original events before the update.
It is set on recurring event delete, when [multiple event selection](#opt-selectMultipleEvents) is enabled.
- `oldEventOccurrence`: *MbscCalendarEvent* - The occurrence of the event which was dragged.
Will be set only if the dragged event was a recurring event occurrence.
- `oldResource`: number | string - The id of the resource from which the event was dragged.
- `oldResourceObj`: *MbscResource* - The resource from which the event was dragged.
- `oldSlot`: number | string - The id of the slot from which the event was dragged.
- `oldSlotObj`: *MbscSlot* - The slot from which the event was dragged.
- `resource`: number | string - The id of the resource where the event was dropped.
- `resourceObj`: *MbscResource* - The resource where the event was dropped.
- `slot`: number | string - The id of the slot where the event was dropped.
- `slotObj`: *MbscSlot* - The slot where the event was dropped.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event is being updated.
- inst - The component instance.
### onEventUpdateFailed
(args: MbscEventUpdateFailedEvent, inst: EventcalendarBase) => void
Triggered when an event update failed due to overlapping an invalid range or another event.
Parameters:
- args - The event argument with the following properties:
- `event`: *MbscCalendarEvent* - The updated event.
- `invalid`: *object* - The invalid object which the event overlapped.
- `overlap`: *MbscCalendarEvent* - The overlapped event.
- `newEvent`: *MbscCalendarEvent* - The newly created event.
Will be set only if the dragged event was a recurring event occurrence.
- `oldEvent`: *MbscCalendarEvent* - The original event before the update.
- `oldEventOccurrence`: *MbscCalendarEvent* - The occurrence of the event which was dragged.
Will be set only if the dragged event was a recurring event occurrence.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event was updated.
- inst - The component instance.
### onEventUpdated
(args: MbscEventUpdatedEvent, inst: EventcalendarBase) => void
Triggered when an event is updated and is rendered in its new position.
This is where you update the event in your database or persistent storage.
Parameters:
- args - The event argument with the following properties:
- `event`: *MbscCalendarEvent* - The updated event.
- `events`: *Array* - The updated events.
It is set on recurring event delete, when [multiple event selection](#opt-selectMultipleEvents) is enabled.
- `oldEvent`: *MbscCalendarEvent* - The original event before the update.
- `oldEvents`: *Array* - The original events before the update.
It is set on recurring event delete, when [multiple event selection](#opt-selectMultipleEvents) is enabled.
- `resourceObj`: *MbscResource* - The resource where the event is updated, if [resources](#opt-resources) are set.
- `slotObj`: *MbscSlot* - The slot where the event is updated, if [slots](#opt-slots) are set.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event was updated.
- `target`: *HTMLElement* - The DOM element of the updated event.
- inst - The component instance.
### onInit
(args: any, inst: any) => void
Triggered when the component is initialized.
Parameters:
- args - The event argument object.
- inst - The component instance.
### onPageChange
(args: MbscPageChangeEvent, inst: EventcalendarBase) => void
Triggered when the calendar page is changed (with buttons or swipe).
Parameters:
- args - The event argument with the following properties:
- `firstDay`: *Date* - The first day of the displayed page.
- `lastDay`: *Date* - The last day of the displayed page, as an exclusive end date, pointing to 00:00 of the next day.
- `month`: *Date* - The first day of the visible month in case of month view.
- inst - The component instance.
### onPageLoaded
(args: MbscPageLoadedEvent, inst: EventcalendarBase) => void
Triggered when the calendar page is changed (with buttons or swipe) and the view finished rendering.
Parameters:
- args - The event argument with the following properties:
- `firstDay`: *Date* - The first day of the displayed page.
- `lastDay`: *Date* - The last day of the displayed page, as an exclusive end date, pointing to 00:00 of the next day.
- `month`: *Date* - The first day of the visible month in case of month view.
- inst - The component instance.
### onPageLoading
(args: MbscPageLoadingEvent, inst: EventcalendarBase) => void
Triggered before the markup of a calendar page is starting to render.
Parameters:
- args - The event argument with the following properties:
- `firstDay`: *Date* - The first day of the displayed page.
- `lastDay`: *Date* - The last day of the displayed page, as an exclusive end date, pointing to 00:00 of the next day.
- `month`: *Date* - The first day of the visible month in case of month view.
- inst - The component instance.
### onResourceClick
(args: MbscResourceClickEvent, inst: EventcalendarBase) => void
Triggered when a resource cell is clicked on the scheduler or timeline.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date of the day on which the resource was clicked, when resources are grouped by day.
- `domEvent`: *Event* - The DOM event of the click.
- `resource`: *MbscResource* - The resource associated with the clicked cell.
- `source`: *'schedule' | 'timeline'* - The view where the cell was clicked.
- `target`: *HTMLElement* - The DOM element of the clicked cell.
- inst - The component instance.
### onResourceDoubleClick
(args: MbscResourceClickEvent, inst: EventcalendarBase) => void
Triggered when a resource cell is double-clicked on the scheduler or timeline.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date of the day on which the resource was clicked, when resources are grouped by day.
- `domEvent`: *Event* - The DOM event of the click.
- `resource`: *MbscResource* - The resource associated with the clicked cell.
- `source`: *'schedule' | 'timeline'* - The view where the cell was clicked.
- `target`: *HTMLElement* - The DOM element of the clicked cell.
- inst - The component instance.
### onResourceHoverIn
(args: MbscResourceHoverEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer hovers a resource cell on the timeline or scheduler view.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date of the hovered resource cell in case of group by date.
- `resource`: *MbscResource* - The hovered resource.
- `source`: *'schedule' | 'timeline'* - The view where the resource cell was hovered.
- `target`: *HTMLElement* - The DOM element of the resource cell.
- inst - The component instance.
### onResourceHoverOut
(args: MbscResourceHoverEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer leaves a resource cell on the timeline or scheduler view.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date of the hovered resource cell in case of group by date.
- `resource`: *MbscResource* - The hovered resource.
- `source`: *'schedule' | 'timeline'* - The view where the resource cell was hovered.
- `target`: *HTMLElement* - The DOM element of the resource cell.
- inst - The component instance.
### onResourceRightClick
(args: MbscResourceClickEvent, inst: EventcalendarBase) => void
Triggered when a resource cell is right-clicked on the scheduler or timeline.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date of the day on which the resource was clicked, when resources are grouped by day.
- `domEvent`: *Event* - The DOM event of the click.
- `resource`: *MbscResource* - The resource associated with the clicked cell.
- `source`: *'schedule' | 'timeline'* - The view where the cell was clicked.
- `target`: *HTMLElement* - The DOM element of the clicked cell.
- inst - The component instance.
### onSelectedDateChange
(args: MbscSelectedDateChangeEvent, inst: EventcalendarBase) => void
Triggered when the selected date is changed, e.g. by clicking on a day on a calendar view, or by using the navigation arrows.
You can use this event in conjunction with the [selectedDate](#opt-selectedDate) option
to customize where the Eventcalendar should navigate.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The newly selected date.
- inst - The component instance.
### onSelectedEventsChange
(args: MbscSelectedEventsChangeEvent, inst: EventcalendarBase) => void
Triggered when an event is selected or deselected on the UI,
when [multiple event selection](#opt-selectMultipleEvents) is enabled.
You can also select events programmatically using the [selectedEvents](#opt-selectedEvents) option.
Parameters:
- args - The event argument with the following properties:
- `events`: *Array* - The selected events.
- inst - The component instance.
### Localization
The Scheduler is fully localized. This covers date and time format, button copy, rtl and more.
### allDayText
string
Text for all day events.
**Default value**: `'All-day'`
### amText
string
Text for AM.
**Default value**: `'am'`
### calendarSystem
MbscCalendarSystem
Specifies the calendar system to be used. Supported calendars:
- Gregorian - Gregorian calendar. This is the default calendar system.
- Jalali - Persian calendar. The Farsi language needs to be included to the package.
- Hijri - Hijri calendar. The Arabic language needs to be included to the package
**Default value**: `undefined`
### dateFormat
string
The format for parsed and displayed dates:
- `M` - month of year (no leading zero)
- `MM` - month of year (two digit)
- `MMM` - month name short
- `MMMM` - month name long
- `D` - day of month (no leading zero)
- `DD` - day of month (two digit)
- `DDD` - day of week (short)
- `DDDD` - day of week (long)
- `YY` - year (two digit)
- `YYYY` - year (four digit)
- `'...'` - literal text
- `''` - single quote
- anything else - literal text
**Default value**: `'MM/DD/YYYY'`
### dateFormatFull
string
Human readable date format, used by screen readers to read out full dates.
Characters have the same meaning as in the [dateFormat](#localization-dateFormat) option.
**Default value**: `'DDDD, MMMM D, YYYY'`
### dateFormatLong
string
Long date format, used by the agenda view and timeline day headers.
Characters have the same meaning as in the [dateFormat](#localization-dateFormat) option.
**Default value**: `'D DDD MMM YYYY'`
### dayNames
Array
The list of long day names, starting from Sunday.
**Default value**: `['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']`
### dayNamesMin
Array
The list of minimal day names, starting from Sunday.
**Default value**: `['S', 'M', 'T', 'W', 'T', 'F', 'S']`
### dayNamesShort
Array
The list of abbreviated day names, starting from Sunday.
**Default value**: `['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']`
### firstDay
number
Set the first day of the week: Sunday is 0, Monday is 1, etc.
**Default value**: `0`
### locale
[MbscLocale](#type-MbscLocale)
Sets the language of the component. The locale object contains all the translations for a given language.
The built in language modules are listed below. If a language is not listed, it can be provided as a
[custom language module](https://mobiscroll.com/docs/core-concepts/localization#language-modules).
Supported values:
- Arabic: `localeAr`, `'ar'`
- Bulgarian: `localeBg`, `'bg'`
- Catalan: `localeCa`, `'ca'`
- Czech: `localeCs`, `'cs'`
- Chinese: `localeZh`, `'zh'`
- Croatian: `localeHr`, `'hr'`
- Danish: `localeDa`, `'da'`
- Dutch: `localeNl`, `'nl'`
- English: `localeEn` or `undefined`, `'en'`
- English (UK): `localeEnGB`, `'en-GB'`
- Farsi: `localeFa`, `'fa'`
- German: `localeDe`, `'de'`
- Greek: `localeEl`, `'el'`
- Spanish: `localeEs`, `'es'`
- Finnish: `localeFi`, `'fi'`
- French: `localeFr`, `'fr'`
- Hebrew: `localeHe`, `'he'`
- Hindi: `localeHi`, `'hi'`
- Hungarian: `localeHu`, `'hu'`
- Italian: `localeIt`, `'it'`
- Japanese: `localeJa`, `'ja'`
- Korean: `localeKo`, `'ko'`
- Lithuanian: `localeLt`, `'lt'`
- Norwegian: `localeNo`, `'no'`
- Polish: `localePl`, `'pl'`
- Portuguese (Brazilian): `localePtBR`, `'pt-BR'`
- Portuguese (European): `localePtPT`, `'pt-PT'`
- Romanian: `localeRo`, `'ro'`
- Russian: `localeRu`, `'ru'`
- Russian (UA): `localeRuUA`, `'ru-UA'`
- Slovak: `localeSk`, `'sk'`
- Serbian: `localeSr`, `'sr'`
- Swedish: `localeSv`, `'sv'`
- Thai: `localeTh`, `'th'`
- Turkish: `localeTr`, `'tr'`
- Ukrainian: `localeUa`, `'ua'`
**Default value**: `undefined`
### monthNames
Array
The list of full month names.
**Default value**: `['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']`
### monthNamesShort
Array
The list of abbreviated month names.
**Default value**: `['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']`
### newEventText
string
Title for the newly created event with the [dragToCreate](#opt-dragToCreate) and the
[clickToCreate](#opt-clickToCreate) action.
**Default value**: `'New event'`
### nextPageText
string
Text for the next button in the calendar header, used as accessibility label.
**Default value**: `'Next page'`
### pmText
string
Text for PM.
**Default value**: `'pm'`
### prevPageText
string
Text for the previous button in the calendar header, used as accessibility label.
**Default value**: `'Previous page'`
### rtl
boolean
Enables right-to-left display.
**Default value**: `false`
### timeFormat
string
The format for parsed and displayed times:
- `h` - 12 hour format (no leading zero)
- `hh` - 12 hour format (leading zero)
- `H` - 24 hour format (no leading zero)
- `HH` - 24 hour format (leading zero)
- `m` - minutes (no leading zero)
- `mm` - minutes (leading zero)
- `s` - seconds (no leading zero)
- `ss` - seconds (leading zero)
- `a` - lowercase am/pm
- `A` - uppercase AM/PM
- `'...'` - literal text
- `''` - single quote
- anything else - literal text
**Default value**: `'hh:mm A'`
### todayText
string
Text for the "Today" button.
**Default value**: `'Today'`
### Renderers
The display of the Scheduler can be customized with different render functions.
### renderBufferAfter
(event: MbscCalendarEventData) => any
Customize the buffer area that is displayed at the end of the scheduler and timeline events.
The buffer can be defined with the help of the `bufferAfter` property of the [event data](#opt-data).
The template will receive an event object as data.
Some of the event specific details are computed, but there is also a reference to the **original** event they come from.
The following event specific properties are available:
- `allDay`: _string_ - The localized all-day text in case of all day events.
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `lastDay`: _boolean_ - True if it's rendered on the last day of a multiple event.
- `original`: _MbscCalendarEvent_ - The original event object.
- `start`: _string_ - The formatted start time, if the event is not all day.
- `title`: _string_ - The title of the event.
- `currentResource`: _string | number_ - The resource of the row or column where the event is being rendered.
**Default value**: `undefined`
### renderBufferBefore
(event: MbscCalendarEventData) => any
Customize the buffer area that is displayed at the start of the scheduler and timeline events.
The buffer can be defined with the help of the `bufferBefore` property of the [event data](#opt-data).
The template will receive an event object as data.
Some of the event specific details are computed, but there is also a reference to the **original** event they come from.
The following event specific properties are available:
- `allDay`: _string_ - The localized all-day text in case of all day events.
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `lastDay`: _boolean_ - True if it's rendered on the last day of a multiple event.
- `original`: _MbscCalendarEvent_ - The original event object.
- `start`: _string_ - The formatted start time, if the event is not all day.
- `title`: _string_ - The title of the event.
- `currentResource`: _string | number_ - The resource of the row or column where the event is being rendered.
**Default value**: `undefined`
### renderCell
(args: MbscCalendarCellData) => any
Customize the cells of the Eventcalendar in scheduler and timeline views.
The template will receive an object as context, which can be used to display custom content in the cells.
Keep the cell template simple, as it will be called and rendered **very frequently** during scroll and view changes.
The object passed to the template contains the following properties:
- `colors`: _Array_ - The list of colors for the current cell.
- `date`: _Date_ – The current cell's date.
- `events`: _Array_ - The list of events for the current cell.
- `invalids`: _Array_ - The list of invalids for the current cell.
- `resource`: _MbscResource_ – The resource object for the current cell.
- `slot`: _MbscSlot_ - The slot object for the current cell.
**Default value**: `undefined`
### renderDay
(args: MbscCalendarDayData) => any
Customize the day cells of the calendar view and the date header in case of scheduler and timeline views.
If you are looking to customize only the day cells content and don't want to bother with the styling of the event,
in case of calendar and scheduler views you can use the [renderDayContent](#renderer-renderDayContent) option.
The following day specific details are available:
- `date`: _Date_ - The date of the rendered day.
- `selected`: _boolean_ - True if the date is selected (in case of the calendar view).
- `events`: _Array_ - The list of events for the day.
- `resource`: _string | number_ - The id of the resource in case of the scheduler (week and month views)
when the events are grouped by resources.
- `isActive`: _boolean_ - True for the current day (in case of the timeline view).
**Default value**: `undefined`
### renderDayContent
(args: MbscCalendarDayData) => any
Customize the day cells content of the event calendar. The Eventcalendar will take care of the styling and you can focus on
what you show beside the day number.
If you are looking to fully customize the day (e.g. add custom hover effects) you will need to use the
[renderDay](#renderer-renderDay) option.
The following properties are available:
- `date`: _Date_ - The date of the rendered day.
- `selected`: _boolean_ - True if the date is selected (in case of the calendar view).
- `events`: _Array_ - The list of events for the day.
- `resource`: _string | number_ - The id of the resource in case of the scheduler (week and month views)
when the events are grouped by resources.
**Default value**: `undefined`
### renderHeader
() => any
Customize the header of the event calendar.
You can use custom markup and the built in header components of the calendar.
**Default value**: `undefined`
### renderResource
(resource: [MbscResource](#type-MbscResource), day: Date) => any
Customize how the resources are rendered on the scheduler and timeline views.
The following properties are available:
- `resource`: _MbscResource_ - The rendered resource.
- `day`: _Date_ - The date on which the resource is rendered.
Available when grouping by date in the scheduler view,
or when vertical day resolution is used in the timeline view.
**Default value**: `undefined`
### renderScheduleEvent
(event: MbscCalendarEventData) => any
Customize the events that appear on the scheduler and timeline.
The Eventcalendar will take care of the positioning,
but everything else (like background color, hover effect, etc.) is left to you.
If you are looking to customize only the content (e.g. add custom elements) and don't want to bother with the styling of the event,
you can use the [renderScheduleEventContent](#renderer-renderScheduleEventContent) option.
Some of the event specific details are computed, but there is also a reference to the **original** event they come from.
The following event specific properties are available:
- `allDay`: _string_ - The localized all-day text in case of all day events.
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `lastDay`: _boolean_ - True if it's rendered on the last day of a multiple event.
- `original`: _MbscCalendarEvent_ - The original event object.
- `start`: _string_ - The formatted start time, if the event is not all day.
- `title`: _string_ - The title of the event.
- `currentResource`: _string | number_ - The resource of the row or column where the event is being rendered.
**Default value**: `undefined`
### renderScheduleEventContent
(event: MbscCalendarEventData) => any
Customize the event content that appears on the scheduler and timeline.
The Eventcalendar will take care of styling and you can focus on what you show inside of the event.
If you are looking to fully customize the event (e.g. add custom hover effects) you will need to use
the [renderScheduleEvent](#renderer-renderScheduleEvent) option. In that case you will only get
the positioning done by the Eventcalendar and everything else is up to you.
Some of the event specific details are computed, but there is also a reference to the **original** event they come from.
The following event specific properties are available:
- `allDay`: _string_ - The localized all-day text in case of all day events.
- `end`: _string_ - The formatted end time, if the event is not all day.
- `id`: _string_ - The id of the event.
- `isMultiDay`: _boolean_ - True if the event spans across multiple days.
- `lastDay`: _boolean_ - True if it's rendered on the last day of a multiple event.
- `original`: _MbscCalendarEvent_ - The original event object.
- `start`: _string_ - The formatted start time, if the event is not all day.
- `title`: _string_ - The title of the event.
- `currentResource`: _string | number_ - The resource of the row or column where the event is being rendered.
**Default value**: `undefined`
### Types
### MbscCalendarColor
Interface
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 color
- `end`: *string | object | Date* - Specifies the end date/time of a date/time range for the color
- `highlight`: *string* - Highlight color of the day, can be any valid CSS color (`'red'`, `'#ff0000'`, `'rgb(255, 0, 0)'`, etc.).
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring days.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Exception rule of the recurring rule.
Useful when recurring dates need to be skipped from the rule.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 color
- `textColor`: *string* - A color applied on the text.
- `title`: *string* - A title that will be displayed on the item.
### MbscCalendarEvent
Interface
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 event
- `cssClass`: *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 event
- `dragBetweenResources`: *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 event
- `id`: *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 the `eventOverlap`
property of the resource and the [eventOverlap](#opt-eventOverlap) option.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring events.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 the `eventResize` property of the resource and
the [dragToResize](#opt-dragToResize) option.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 event
- `textColor`: *string* - A color applied on the text.
- `timezone`: *string* - Timezone of the event
- `title`: *string* - The title of the event.
- `tooltip`: *string* - The tooltip text of the event.
### MbscCalendarInvalid
Interface
Properties:
- `allDay`: *boolean* - If true the specified invalid will cover the whole day.
- `end`: *[MbscDateType](#type-MbscDateType)* - Specifies the end of the invalid range.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Recurrence rule for recurring invalid ranges.
- `recurringException`: *[MbscDateType](#type-MbscDateType) | Array<[MbscDateType](#type-MbscDateType)>* - Specifies recurring exceptions.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence exception rule.
Useful when recurring dates need to be skipped from the rule.
- `start`: *[MbscDateType](#type-MbscDateType)* - Specifies the start of the invalid range.
### MbscDateType
string | Date | object
### MbscLocale
Interface
Properties:
- `allDayText`: *string*
- `amText`: *string*
- `calendarSystem`: *MbscCalendarSystem*
- `cancelText`: *string*
- `clearText`: *string*
- `closeText`: *string*
- `dateFormat`: *string*
- `dateFormatFull`: *string*
- `dateFormatLong`: *string*
- `dateText`: *string*
- `dateWheelFormat`: *string*
- `dayNames`: *Array*
- `dayNamesMin`: *Array*
- `dayNamesShort`: *Array*
- `daySuffix`: *string*
- `dayText`: *string*
- `eventText`: *string*
- `eventsText`: *string*
- `filterEmptyText`: *string*
- `filterPlaceholderText`: *string*
- `firstDay`: *number*
- `fromText`: *string*
- `hourText`: *string*
- `minuteText`: *string*
- `monthNames`: *Array*
- `monthNamesShort`: *Array*
- `monthSuffix`: *string*
- `monthText`: *string*
- `moreEventsPluralText`: *string*
- `moreEventsText`: *string*
- `nextMonthText`: *string*
- `nextYearText`: *string*
- `noEventsText`: *string*
- `nowText`: *string*
- `pmText`: *string*
- `prevMonthText`: *string*
- `prevYearText`: *string*
- `rangeEndHelp`: *string*
- `rangeEndLabel`: *string*
- `rangeStartHelp`: *string*
- `rangeStartLabel`: *string*
- `rtl`: *boolean*
- `secondText`: *string*
- `selectedPluralText`: *string*
- `selectedText`: *string*
- `setText`: *string*
- `timeFormat`: *string*
- `timeText`: *string*
- `timeWheels`: *string*
- `toText`: *string*
- `todayText`: *string*
- `weekText`: *string*
- `yearSuffix`: *string*
- `yearText`: *string*
### MbscRecurrenceRule
Interface
Properties:
- `count`: *number*
- `day`: *number | Array*
- `from`: *[MbscDateType](#type-MbscDateType)*
- `interval`: *number*
- `month`: *number | Array*
- `pos`: *number*
- `repeat`: *"daily" | "weekly" | "monthly" | "yearly"*
- `until`: *[MbscDateType](#type-MbscDateType)*
- `weekDays`: *string*
- `weekStart`: *string*
### MbscResource
Interface
Properties:
- `background`: *string* - Specifies the background color of the resource row or column.
- `children`: *Array<[MbscResource](#type-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](#opt-dragBetweenResources) option.
- `eventDragBetweenSlots`: *boolean* - Specifies whether the events in this slot are movable across slots.
Has precedence over the [dragBetweenSlots](#opt-dragBetweenSlots) option.
- `eventDragInTime`: *boolean* - Specifies whether the events in this resource are movable in time.
Has precedence over the [dragInTime](#opt-dragInTime) option.
- `eventOverlap`: *boolean* - Specifies whether the events in this resource can be overlapped.
Has precedence over the [eventOverlap](#opt-eventOverlap) option.
- `eventResize`: *boolean* - Specifies whether the events in this resource are resizable.
Has precedence over the [dragToResize](#opt-dragToResize) option.
- `fixed`: *boolean* - Specifies whether the resource is fixed to the top.
It applies for timeline view if `resolutionVertical` in [view](#opt-view) option is not given, or it's value is set to `none`.
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 if `resourceReorder` in [view](#opt-view) option is enabled.
The `MbscResource` supports custom properties in the form:
```
[x:string]: any
```
### MbscResponsiveOptions
Interface
The `MbscResponsiveOptions` supports custom properties in the form:
```
[key:string]: MbscEventcalendarOptions & {breakpoint?: number}
```
The keys are the names of the breakpoints, and the values are objects containing the options for the given breakpoint.
The `breakpoint` property, when present, specifies the min-width in pixels. The options will take into effect from that width.
:::info
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: 0px
- `small` - min-width: 576px
- `medium` - min-width: 768px
- `large` - min-width: 992px
- `xlarge` - min-width: 1200px
### MbscTimezonePlugin
Interface
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*
---
## Setting the initial view
By default the initial view of the calendar displays the current date. Depending on the view type, this might be the current day, week, month or year. For views, where time is also displayed, the view will be scrolled to the current time as well.
To change the initial view to another date, the [`selectedDate`](./api#opt-selectedDate) option can be used.
```js
mobiscroll.eventcalendar('#myDiv', {
data: [/*...*/],
selectedDate: new Date(2020, 2, 18)
});
```
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.
When multiple days, weeks, months or years are displayed, the position of the specified date on the view (first, second, third, etc. day/week/month/year) is determined by the [`refDate`](./api#opt-refDate) option.
---
## Templating
## Overview
You can customize many parts of the Eventcalendar by writing custom templates. In the context of plain javascript these templates are functions that return a string containing the html markup. You will find a comprehensive list of all the available render functions for the Eventcalendar in the [API templates](api#renderers) section.
## Event templating
When you want to customize how the events look, depending on what your goal is, you have two options:
1. [Customize the event content](#event-content-templating) - Mobiscroll takes care of rendering the events in the correct order and also prints basic fields, like `start`/`end`, whether it is an `allDay` event or not and also takes care of coloring the event appropriately. Everything else comes from the custom template.
2. [Customize the full event](#full-event-templating) - Mobiscroll takes care of rendering the events in the correct order, but everything else comes form the template you write.
To define a custom template, pass a functional to the apropriate option that returns the desired html:
```js title="Customizing the scheduler event contents"
mobiscroll.eventcalendar('#myDiv', {
renderScheduleEventContent: function (theEvent) {
return `
${theEvent.title}
`;
}
});
```
### Event content templating
In most cases you only want to customize the content section of the event. In this case your template will be used as the content of the event. Mobiscroll will position the event to the right place and will render essential information like the color of the event, the time and if it's an all day event or not. The title, description and any other fields you want to show (like participants, an avatar...) will be coming from your custom template.
- For the agenda and popover - use the [`renderEventContent`](api#renderer-renderEventContent) option for the custom template
- For event labels in the calendar and all-day events in the scheduler - use the [`renderLabelContent`](api#renderer-renderLabelContent) option for the custom template
- For the scheduler and timeline - use the [`renderScheduleEventContent`](api#renderer-renderScheduleEventContent) option for the custom template
```js
mobiscroll.eventcalendar('#myDiv', {
renderEventContent: function (theEvent) {
// return your content here
},
});
```
Play with the slider below to see the differences.
### Full event templating
In case of full event templating, whenever there is an event (in the agenda, scheduler, timeline, labels or popover) your custom template will be used instead of the default template. Mobiscroll will position your component to the right place, but anything else you want to show is up to you... like a title, description, color the background or show any content.
- For the agenda and popover - use the [`renderEvent`](api#renderer-renderEvent) option for the custom template
- For event labels in the calendar and all-day events in the scheduler - use the [`renderLabel`](api#renderer-renderLabel) option for the custom template
- For the scheduler and timeline - use the [`renderScheduleEvent`](api#renderer-renderScheduleEvent) option for the custom template
Play with the slider below to see the differences.
## Resource templating
To customize the display of the resources, the [`renderResource`](api#renderer-renderResource) option can be used.
```js
mobiscroll.eventcalendar('#myDiv', {
renderResource: function (resource) {
return "
" + resource.name + " - " + resource.location + "
";
},
});
```
:::info
In case of the timeline view there are other parts of the Eventcalendar that can be customized through templates. Check out the [timeline templating](timeline#templating) section for more details.
:::
Play with the slider below to see the differences.
## Header templating
The header of the calendar can be fully customized to one's needs with the use of the [`renderHeader`](api#renderer-renderHeader) option.
```js
mobiscroll.eventcalendar('#myDiv', {
renderHeader: function () {
return "
Any Title you want here
";
},
});
```
While fully customizing the header is very usefull, sometimes it's desireable to customize only parts of it. In this case you can take advantage of the default header's building blocks. These components let you put toghether the header you want, while you don't have to worry about the functionality behind them.
For example you can leave out parts from the default header, change the order of the default buttons appearance or add custom components between them.
Here's the list of the built in components of the default header. You can initialize these by putting the attributes on the elements:
- `mbsc-calendar-prev` - Previous button component, that navigates to the previous month.
- `mbsc-calendar-next` - Next button component, that navigates to the next month.
- `mbsc-calendar-today` - Today button component, that navigates to the current date.
- `mbsc-calendar-nav` - The title navigation button component, that opens the year/month navigation.
The above components can be used inside of the custom header. The following example will render the prev and next buttons and then a custom title that is set from a custom variable (myTitle variable).
```js title="Custom header with default buttons"
mobiscroll.eventcalendar('#myDiv', {
renderHeader: function () {
const myTitle = 'Awesome Title';
return `
${myTitle}
`;
},
});
```
Play with the slider below to see the differences.
---
## Timeline
Use the [Timeline view](https://demo.mobiscroll.com/timeline) which features a horizontally scrollable view with multiple resource support for [day, week, work-week, month and year view](https://demo.mobiscroll.com/timeline/multiple-days-weeks-months-quarters-years-variable-resolution) with built in [templating](#templating), [drag & drop](https://demo.mobiscroll.com/timeline/move-resize-drag-drop-to-create-events) and more.
## Overview
This Timeline view displays a timeline with its related events. You can render the [times/days horizontally and the resources vertically](https://demo.mobiscroll.com/timeline/timeline-time-grid). The Timeline can easily accommodate a [large number of resources](https://demo.mobiscroll.com/timeline/loading-big-data-sets) thanks to the vertical scroll that is easy to understand for users. This plays well on larger screens and in landscape containers. [Work hours and work days](https://demo.mobiscroll.com/timeline/switching-day-week-work-week-timeline) along with [disabled time-spans, breaks](https://demo.mobiscroll.com/timeline/colors-invalids-css-class) can be added. Use it to for [advanced tasks](https://demo.mobiscroll.com/timeline/restaurant-shift-management) with built-in drag & drop.
By default the Timeline rows will have variable height and will expand to accommodate the displayed events. But, this can be changed by the `rowHeight` property of the [Timeline view](#opt-view) option. [If it is set to equal](https://demo.mobiscroll.com/timeline/timeline-resource-height), the rows will have equal heights, and overlapping events will be distributed evenly to fit in the row.
Also, the `eventList` [property](#opt-view) transforms the event display into a [daily listing mode](https://demo.mobiscroll.com/timeline/event-listing). This view represents a daily summary rather than an hour-by-hour layout.
The capabilities like [recurring events](/javascript/core-concepts/recurrence), [all-day, multi-day events](#opt-data), [responsiveness](#responsiveness) are supported by the Timeline.

## Showing the Timeline
### Configuring the view
The Timeline view can be configured through the `view` option. Below are listed the `timeline` object properties which can help you fine-tune this view.
```javascript title='Example'
mobiscroll.eventcalendar('#timeline', {
view: {
timeline: {
maxEventStack: 2,
eventList: true,
resolutionHorizontal: 'day',
type: 'week',
resourceReorder: true
}
}
});
```
### columnWidth
MbscTimelineColumnWidth
Sets the width of grid columns in the timeline to one of the predefined column widths.
Possible values and their corresponding widths:
- `xxsmall`: 1.5em
- `xsmall`: 3em
- `small`: 4.5em
- `medium`: 6em
- `large`: 7.5em
- `xlarge`: 9em
- `xxlarge`: 10.5em
- `xxxlarge`: 12em;
When not defined, the column width will be set automatically based on the view type and size.
:::info
You can [customize the predefined column widths using CSS](./timeline#column-width) to fit your layout needs.
:::
**Default value**: `undefined`
### currentTimeIndicator
boolean
Show or hide the current time indicator.
Defaults to `true`, when the horizontal resolution is less than a day.
### endDay
number
Specifies the last visible weekday of the view. Sunday is 0, Monday is 1, etc.
Days outside of the `startDay` and `endDay` range will not be visible.
**Default value**: `6`
### endTime
string
Specifies the end time of schedule column.
Hours and minutes can be specified in the same string, example: '18:30'.
**Default value**: `'24:00'`
### eventHeight
"variable" | "equal"
Specifies wether the height of the events is equal or variable.
:::info
[Learn more about variable event heights](https://mobiscroll.com/docs/eventcalendar/timeline#variable-event-height).
:::
**Default value**: `'equal'`
### eventList
boolean
If `true`, transforms the layout into a summary view.
The events are listed in the appropriate cell one after the other.
**Default value**: `false`
### hideEmptyRows
boolean
Hide the empty rows.
:::info
Parent resources will always be displayed, even when empty.
:::
**Default value**: `false.`
### hideInvalidRows
boolean
Hide the fully invalid rows.
:::info
Parent resources will always be displayed, even when fully invalid, unless `resolutionVertical: 'day'` is used.
:::
**Default value**: `false.`
### maxEventStack
number | "all"
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.
**Default value**: `'all'`
### ~~resolution~~ (deprecated)
"day" | "hour" | "month" | "year" | "week" | "quarter"
DEPRECATED: Use the `resolutionHorizontal` and `resolutionVertical` properties instead.
Specifies the resolution of the timeline column.
Possible values: 'hour', 'day', 'week', 'month', 'quarter', 'year'.
### resolutionHorizontal
"day" | "hour" | "month" | "year" | "week" | "quarter"
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 the `timeCellStep` and `timeLabelStep` properties.
**Default value**: `'hour'`
### resolutionVertical
"day"
Sets the vertical time unit of the timeline to days.
When set to 'day', the days will be rendered on the vertical axis,
while the hours of the day will be displayed on the horizontal axis.
**Default value**: `undefined`
### resourceReorder
boolean
Specifies whether the resource can be dragged and reordered.
A drag handle icon will appear in front of the resource name,
serving as the point of interaction to drag and reposition the resource.
**Default value**: `false`
### rowHeight
"variable" | "equal"
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.
**Default value**: `'variable'`
### size
number
Specifies the number of displayed years, months, weeks or days.
**Default value**: `1`
### startDay
number
Specifies the first visible weekday of the view. Sunday is 0, Monday is 1, etc.
Days outside of the `startDay` and `endDay` range will not be visible.
Should not be mistaken for the [firstDay](#localization-firstDay) option,
which sets the first day of the week, and, if not set, is defined by the [localization](#localization-locale).
**Default value**: `0`
### startTime
string
Specifies the start time of schedule column.
Hours and minutes can be specified in the string, example: '09:30'.
**Default value**: `'00:00'`
### timeCellStep
number
Specifies the step of the grid cells in minutes.
Supported values: 1, 5, 10, 15, 20, 30, 60, 120, 180, 240, 360, 480, 720, 1440
**Default value**: `60`
### timeLabelStep
number
Specifies the step of the time labels in minutes.
Supported values: 1, 5, 10, 15, 20, 30, 60, 120, 180, 240, 360, 480, 720, 1440.
**Default value**: `60`
### type
"day" | "month" | "year" | "week"
Specifies the timeline type.
**Default value**: `'week'`
### virtualScroll
boolean
Enable or disable virtual scroll.
**Default value**: `true`
### weekNumbers
boolean
Show or hide week numbers.
**Default value**: `false`
### zoomLevels
{ [key:string]: MbscTimelineZoomLevel }
Defines configuration options for multiple zoom levels for the timeline view.
Each zoom level can specify its own properties for displaying a custom layout.
Use the [zoomLevel](#opt-zoomLevel) option to select the current zoom level.
Available properties:
- `size`
- `resolutionHorizontal`
- `resolutionVertical`
- `columnWidth`
- `currentTimeIndicator`
- `endDay`
- `endTime`
- `eventList`
- `startDay`
- `startTime`
- `timeCellStep`
- `timeLabelStep`
- `weekNumbers`
- `type`
**Default value**: `undefined`
### Event slots
Besides the [`resources`](#opt-resources) which are grouping data for the whole date range, [`slots`](#opt-slots) introduce a horizontal daily grouping in case of the Timeline view. Slots can be used alongside resources.
The [renderSlot](#renderer-renderSlot) function can be used to [customize the slot template](https://demo.mobiscroll.com/timeline/shift-template) of the Timeline view.
When [slots are used](https://demo.mobiscroll.com/timeline/employee-shifts) the Timeline view will display in daily listing mode and only the [`dragToMove`](#opt-dragToMove) event iteraction will be available. The [`dragToCreate`](#opt-dragToCreate) and [`dragToResize`](#opt-dragToResize) interactions will be truned off.
```javascript title="Slots used for work shift management"
mobiscroll.eventcalendar('#timeline', {
slots: [
{
id: 1,
name: "Morning shift",
},
{
id: 2,
name: "Afternoon shift",
},
]
});
```

### Column width
The [`columnWidth`](timeline#view-timeline-columnWidth) option in the timeline view allows you to control the width of the timeline columns. It supports the following predefined sizes: xxsmall, xsmall, small, medium, large, xlarge, xxlarge, and xxxlarge.
Here are the default sizes and their corresponding widths:
```css
.mbsc-timeline-column-xxs {
width: 1.5em; // 24px
}
.mbsc-timeline-column-xs {
width: 3em; // 48px
}
.mbsc-timeline-column-s {
width: 4.5em; // 72px
}
.mbsc-timeline-column-m {
width: 6em; // 96px
}
.mbsc-timeline-column-l {
width: 7.5em; // 120px
}
.mbsc-timeline-column-xl {
width: 9em; // 144px
}
.mbsc-timeline-column-xxl {
width: 10.5em; // 168px
}
.mbsc-timeline-column-xxxl {
width: 12em; // 192px
}
```
To specify the columnWidth in your view configuration, include it as part of the timeline view options:
```ts
view: {
timeline: {
columnWidth: 'large'
}
}
```
The predefined sizes correspond to specific default widths, but you can override them using CSS:
```css
.mbsc-timeline-column-l {
width: 50px;
}
```
:::caution
You need to apply these rules after the mobiscroll default rules, otherwise the default rules will take precedence over them.
:::
## Resources
### Resource grouping and hierarchy
The Timeline view supports resource hierarchy. [Hierarchy groups](https://demo.mobiscroll.com/timeline/resource-grouping-hierarchy) can be defined with the `children` property of the `resources` [object](#opt-resources). Child objects are also resources and have the same properties, thus they can also have children.
```javascript title="Multi-level hierarchy groups"
mobiscroll.eventcalendar('#myDiv', {
resources: [{
name: 'Site 1',
children: [{
name: 'Building 1'
children: [{
name: 'Room 1'
}, {
name: 'Room 2'
}]
}, {
name: 'Building 2'
}]
}, {
name: 'Site 2',
children: [{
name: 'Building A'
}]
}]
});
```
By default every resource group will be displayed and this can be modified with the `collapsed` attribute of the parent objects.
```javascript title="Collapsed groups"
mobiscroll.eventcalendar('#myDiv', {
resources: [{
name: 'Main Building',
id: 'main',
description: 'Used the most for scheduling'
collapsed: true,
children: [{
name: 'Big conf. room'
id: 'bfg',
}, {
name: 'Smaller conf. room'
id: 'sfg',
}]
}, {
name: 'Secondary Building',
id: 'sec',
description: 'For smaller, less important meetings'
collapsed: false,
children: [...]
}, {
name: 'Long forgotten Cave',
id: 'cave',
description: 'Where developers used to work'
collapsed: false,
}]
})
```
Both parent and child rows can contain events and events can be moved between any rows.
```javascript title="Resources & events"
mobiscroll.eventcalendar('#myDiv', {
resources: [{
name: 'Main Building',
id: 'main',
children: [{
name: 'Big conf. room'
id: 'bfg',
}]
}, {
name: 'Secondary Building',
id: 'sec',
}],
data: [
{ title: 'Open day celebration', resource: 'main', date: '2023-08-24'},
{ title: 'Monthly staff meeting', resource: 'bfg', start: '2023-08-01T11:00', end: '2023-08-01T11:00' },
{ title: 'Weekly chit-chat', resource: 'sec', start: '2023-08-02T09:00', end: '2023-08-02T09:40' },
...
]
});
```
Child or parent rows can be disabled by creating an [invalid rule](#opt-invalid) which repeats daily and it is tied to the specific resources. Example:
```javascript title="Disable parent and/or child resources"
mobiscroll.eventcalendar('#myDiv', {
invalid: [
{
recurring: { repeat: "daily" },
resource: [
/* resource id(s) */
],
},
]
});
```
### Resource order
The initial order in which the resources appear on the timeline follows the order of the array passed to the component. If the initial order needs to be changed, sort the resource array before passing it to the event calendar.
For dynamic sorting during runtime, sort the resource array and pass the updated array to the calendar.
Resources can be [reordered directly through the UI](https://demo.mobiscroll.com/timeline/resource-drag-drop-reorder) by enabling the `resourceReorder` option in the [view](#configuring-the-view) configuration. When enabled, a drag handle icon will appear before each resource, serving as the point of interaction to drag and reposition the resource.
After a resource is dragged and dropped to a new position, the [onResourceOrderUpdate](#event-onResourceOrderUpdate) lifecycle event is triggered. To make specific resources non-draggable, set the `reorder` property of the corresponding resource object to `false`;
### Resource external drag and drop
You can drag and drop resources into or out of the timeline view, allowing for easy organization and adjustments.
#### Targeting the timeline
To allow external resources to be dragged into your timeline, first set the the [`externalResourceDrop`](./api#opt-externalResourceDrop) option to `true`. As a second step, you'll need to create your external [draggable](./drag-and-drop#draggable) element and pass a skeleton resource definition through the `dragData` option. Make sure to also set `type="resource"` on the draggable element so the timeline correctly identifies it as a resource.
#### The timeline as a source
Resources can be dragged out of the timeline and dropped onto another instance of the Timeline or any [Dropcontainer](./drag-and-drop#dropcontainer). To enable this behavior, you'll need to set the [`externalResourceDrag`](./api#opt-externalResourceDrag) option to `true`.
When a resource is dragged out of the timeline, the [`onResourceDragLeave`](./api#event-onResourceDragLeave) lifecycle event is triggered. A visual clone of the resource is shown to indicate the movement. If the resource is dropped into an external drop container or another timeline, it gets removed from the original timeline. This action also triggers the [`onResourceDelete`](./api#event-onResourceDelete) and [`onResourceDeleted`](./api#event-onResourceDeleted) lifecycle events.
When a resource is dragged into the timeline, the [`onResourceDragEnter`](./api#event-onResourceDragEnter) lifecycle event is triggered. If the resource is dropped, the [`onResourceCreate`](./api#event-onResourceCreate) and [`onResourceCreated`](./api#event-onResourceCreated) events will be fired, finalizing the addition.
### Resource column width
The width of the resources column on the Timeline view is fixed. It can be overwritten from CSS using the following rule:
```css title="Resource column width"
.mbsc-timeline-resource-col {
width: 200px;
}
```
The width of the resource column adjusts as resources are expanded or collapsed. The default increment step can be modified with a CSS rule:
```css title="Resource expand step"
.mbsc-timeline-resource-depth-step {
width: 20px;
}
```
If the step adjustment is not needed, it can disabled by setting the value to `width: 0;`.
### Resource row height
There are three CSS classes which can be used for [changing the height of resource rows](https://demo.mobiscroll.com/timeline/setting-row-height):
1. For setting the resource row heights in general, you can use the `.mbsc-timeline-row` class.
```css
.mbsc-timeline-row {
height: 80px;
}
```
2. For setting the height of the parent resources, you can use the `.mbsc-timeline-parent` class.
```css
.mbsc-timeline-parent {
height: 30px;
}
```
:::info
There's minimum height of the rows which can only be decreased if the event creation is disabled on the relevant resource. You can prevent event creation by using the `eventCreation` property of the the [`resources`](#opt-resources) option.
:::
3. For customizing the remaining empty space below the events, you can use the `.mbsc-timeline-row-gutter` class.
```css
.mbsc-timeline-row-gutter {
height: 6px;
}
```
### Hide empty resources
Rows without any events can be hidden by setting `hideEmptyRows` to `true` under the [view](#configuring-the-view) configuration.
:::info
Parent resources will always be displayed, even when empty.
If [resolutionVertical](#view-timeline-resolutionVertical) is set to `'day'` and all resources for a given day are empty, the entire day will be hidden.
:::
### Hide invalid resources
Fully invalid rows can be hidden by setting `hideInvalidRows` to `true` under the [view](#configuring-the-view) configuration.
:::info
A resource row is considered fully invalid if it contains [invalid](#opt-invalid) periods defined with `allDay`, date values,
or a single time range that covers a full day or multiple days.
Parent resources will always be displayed, even when fully invalid.
If [resolutionVertical](#view-timeline-resolutionVertical) is set to `'day'` and all resources for a given day are fully invalid, the entire day will be hidden.
:::
## Virtual scroll
Virtual scroll is a performance optimization that ensures smooth scrolling and fast rendering when displaying large numbers of events or resources in the timeline.
The timeline view is virtualized, meaning its markup is dynamically generated and managed as needed. As you scroll vertically or horizontally, the component updates what's visible in real time, only rendering the elements that appear in the viewport.
This approach dramatically improves performance for large datasets: events and resources are not all loaded into memory at once, keeping the interface fast and responsive.
When virtual scroll is enabled, the timeline calculates which items should be displayed based on the current scroll position.
Only the visible portion of the view is rendered, while non-visible parts are skipped until they come into view.
Scrolling triggers the [onVirtualLoading](#event-onVirtualLoading) lifecycle event, which can be used to load data incrementally during scrolling, instead of fetching everything upfront.
You can see an example of this pattern in the [Load resources on scroll demo](https://demo.mobiscroll.com/timeline/load-resources-on-scroll).
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 the body and html elements, 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.
In some cases, you may want to disable virtual scroll, for example:
- When working with a small dataset that doesn't benefit from virtualization.
- When you need to access or manipulate all DOM elements at once.
To disable it, set [virtualScroll](#view-timeline-virtualScroll) to `false`.
## Event connections
The Timeline view can [display connections between events](https://demo.mobiscroll.com/timeline/connecting-linking-events-arrows). 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. Connections can be specified with the [`connections`](#opt-connections) option.

## Event order
The rendered event order is determined by the following two concepts:
1. Event data order
2. Event layout
The combination of these concepts results in the final rendered event order.
### Event data order
The sequence in which events are processed before being passed to the layout algorithm. The default ordering rules are as follows:
1. All-day events are placed at the top.
2. Non-all-day events follow, sorted by their start times.
3. Events with the same start time are further ordered alphabetically by their titles.
This default order can be modified using the `order` property in the event [event data](#opt-data). The order property takes precedence over the default rules. If two events have the same order value, the default rules apply. For more complex ordering requirements, the [eventOrder](#opt-eventOrder) option can be used. This option accepts a function that compares two events and returns an order (-1 or 1).
### Event layout
The event layout process determines the visual positioning and dimensions of events. This is a built-in functionality and cannot be altered externally. The layout algorithm processes the sorted event list and calculates each event's position and size. The algorithm follows these steps:
1. The first event is placed in the first position of the event track.
2. If two or more events overlap in their start/end times, the later event is placed in the next event track, positioned below to the previous event.
3. If a subsequent event does not overlap with any already added events, it is placed back in the first event track.
4. This process continues until all events are positioned within their respective rows.
## Responsiveness
The Timeline is fully responsive. It adapts to the available space and fills the screen to look good everywhere. While you don't have to worry about the width the height can be manually adjusted with the [height](#opt-height) option. This 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.
Use the [responsive](#opt-responsive) option to configure how the calendar behaves on different sized screens.
The responsive option is equipped with five breakpoints:
- `xsmall` (up to 575px),
- `small` (up to 767px),
- `medium` (up to 991px),
- `large` (up to 1199px),
- `xlarge` (from 1200px).
Also, custom breakpoints can be added if necessary:
- `my-custom-breakpoint: { breakpoint: 600 }` (from 600px up to the next breakpoint).
:::info
The available width is queried from the container element of the component and not the browsers viewport like in css media queries.
:::
```javascript title='Responsive configuration with the view option'
mobiscroll.eventcalendar('#timeline', {
responsive: {
xsmall: {
view: { timeline: { type: 'day', size: 2 }}
},
medium: {
view: {
timeline: { type: 'week' }
}
},
custom: { // Custom breakpoint, you can use multiple if needed, but each must have a unique name.
breakpoint: 1000,
view: { timeline: { type: 'month' }}
}
}
});
```

## Zoom Levels
The timeline view allows you to define and use multiple zoom levels, making it easy to switch between different time scales. You can select a specific zoom level to focus on the desired level of detail.
### Configuring Zoom Levels
Zoom levels are set up in the [zoomLevels](#view-timeline-zoomLevels) property of the timeline view. Each zoom level can have its own options for customizing the timeline's layout and behavior.
You can specify a zoom level using number or string-based keys, and the corresponding view options will be applied.
### Available options
- [type](#view-timeline-type)
- [size](#view-timeline-size)
- [resolutionHorizontal](#view-timeline-resolutionHorizontal)
- [resolutionVertical](#view-timeline-resolutionVertical)
- [columnWidth](#view-timeline-columnWidth)
- [currentTimeIndicator](#view-timeline-currentTimeIndicator)
- [startDay](#view-timeline-startDay) - [endDay](#view-timeline-endDay)
- [startTime](#view-timeline-startTime) - [endTime](#view-timeline-endTime)
- [timeCellStep](#view-timeline-timeCellStep)
- [timeLabelStep](#view-timeline-timeLabelStep)
- [weekNumbers](#view-timeline-weekNumbers)
### Example Configuration
```ts
view: {
timeline: {
zoomLevels: {
-4: { type: 'year', size: 6, resolutionHorizontal: 'year' },
-3: { type: 'month', size: 6, resolutionHorizontal: 'month' },
-2: { type: 'week', size: 5, resolutionHorizontal: 'week' },
-1: { type: 'week', size: 5, resolutionHorizontal: 'day' },
0: { type: 'week', size: 5, resolutionHorizontal: 'day', columnWidth: 'large' },
1: { type: 'week', size: 5, resolutionHorizontal: 'day', columnWidth: 'xlarge' },
2: { type: 'day', size: 3, resolutionHorizontal: 'hour', timeCellStep: 360, timeLabelStep: 360 },
3: { type: 'day', size: 3, resolutionHorizontal: 'hour', timeCellStep: 180, timeLabelStep: 360 },
4: { type: 'day', size: 3, resolutionHorizontal: 'hour', timeCellStep: 30, timeLabelStep: 60 },
}
}
},
zoomLevel: 0
```
### Setting the Active Zoom Level
The [zoomLevel](#opt-zoomLevel) option determines which zoom level is currently active. When set, the timeline automatically applies the corresponding settings from zoomLevels.
:::info
To ensure the calendar view is correctly aligned when zooming, the getViewDate() method is used to retrieve the current middle date of the visible calendar view. Based on the zoom level, the [refDate](#opt-refDate) is set to a corresponding date, ensuring that the view date can always be scrolled to the center.
:::
Learn how to implement and adjust zoom levels by checking [this example](https://demo.mobiscroll.com/timeline/calendar-zoom#).
## Templating
The display of Timeline can be customized with different [render functions](#renderers).
### The cell
Use the [renderCell](#renderer-renderCell) option to fully customize the Timeline cells. Customize how the cell look and what they show. The renderer function gets an object with properties like date, events, colors, invalids, resource, and slot which can be used to display custom content.
:::info
Since cells are rendered frequently while scrolling, keep the customization lightweight for best performance.
:::
Check out how you can style the cell in [this example](https://demo.mobiscroll.com/scheduler/dynamic-cell-content-template#) or just play with the slider below to see the differences.
### The resource, their header and footer
There are three approaches you can take:
- Use the [renderResource](#renderer-renderResource) option to customize the resource template of the Timeline. Customize how the resource headers look and what they show. Utilize properties passed in the [resources](#opt-resources) array. It takes a function that should return the desired markup. In the returned markup, you can use custom html as well.
- Customize the empty cell content above the resource column with the [renderResourceHeader](#renderer-renderResourceHeader) option. It takes a function that should return the desired markup. In the returned markup, you can use custom html as well.
- Or if you want to customize the empty cell content below the resource column you can achieve this with the [renderResourceFooter](#renderer-renderResourceFooter) option. It takes a function that should return the desired markup. In the returned markup, you can use custom html as well. This element only renders for the Timeline view, if the [renderDayFooter](#renderer-renderDayFooter) option is present.
Check out how you can style these resource parts in [this example](https://demo.mobiscroll.com/timeline/timeline-resource-details-side-panel-footer#) or just play with the slider below to see the differences.
### The sidebar, their header and footer
Besides the resource template, an additional sidebar can be rendered on the opposite end of the row and there are three approaches you can take:
- Use the [renderSidebar](#renderer-renderSidebar) option to render a custom sidebar on the right side of the Timeline. It takes a function that should return the desired markup. In the returned markup, you can use custom html as well. The template will receive the resource object as data. This data can be used to show resource specific things on the sidebar.
- Customize the empty cell content above the sidebar column with the [renderSidebarHeader](#renderer-renderSidebarHeader) option. It takes a function that should return the desired markup. In the returned markup, you can use custom html as well. This element only renders for the Timeline view, if the [renderSidebar](#renderer-renderSidebar) option is present.
- Or if you want to customize the empty cell content below the sidebar column you can achieve this with the [renderSidebarFooter](#renderer-renderSidebarFooter) option. It takes a function that should return the desired markup. In the returned markup, you can use custom html as well. This element only renders for the Timeline view, if the [renderSidebar](#renderer-renderSidebar) option is present.
Check out how you can style the sidebar parts in [this example](https://demo.mobiscroll.com/timeline/timeline-resource-details-side-panel-footer#) or just play with the slider below to see the differences.
### The date header and footer
The headers hold key information like the date, day of the week and in some cases it also holds the full date. Whenever you need to show extra information, or if you would like to change the styling or date format, time format you can use the various header templates, depending on the view configuration. You can also show a footer element, for displaying more information.
Depending on the resolution, the first Timeline row under the navigation header can show a line for each of the following:
#### Hourly header/footer template
With an hourly (or sub-hourly) resolution the [renderHour](#renderer-renderHour) and [renderHourFooter](#renderer-renderHourFooter) options can be used for customizing the header and footer.
#### Daily header/footer template
With a daily resolution, the [renderDay](#renderer-renderDay) and [renderDayFooter](#renderer-renderDayFooter) options can come in handy for customizing the header and footer.
#### Weekly header/footer template
When the resolution is weekly, the [renderWeek](#renderer-renderWeek) and [renderWeekFooter](#renderer-renderWeekFooter) options can be used.
#### Monthly header/footer template
When displaying multiple months, the [renderMonth](#renderer-renderMonth) and [renderMonthFooter](#renderer-renderMonthFooter) options can be used for customizing the header and footer per month.
#### Quarter header/footer template
When displaying multiple quarters, the [renderQuarter](#renderer-renderQuarter) and [renderQuarterFooter](#renderer-renderQuarterFooter) options can be used for customizing the header and footer per quarter.
#### Yearly header/footer template
With a yearly resolution, the [renderYear](#renderer-renderYear) and [renderYearFooter](#renderer-renderYearFooter) options can be used for customizing the header and footer.
Check out how you can style the date header and footer in [this example](https://demo.mobiscroll.com/timeline/hour-day-week-month-quarter-year-header-footer-template#) or just play with the sliders above to see the differences.
### The event and buffer areas
You can use the [renderScheduleEvent](#renderer-renderScheduleEvent) option to customize the events that appear on the scheduler. It should return the markup of the event. The Eventcalendar will take care of the positioning, but anything else you want to show is up to you - like a title, description, color the background or show any content.
The buffers can be customized through the [renderBufferBefore](#renderer-renderBufferBefore) and [renderBufferAfter](#renderer-renderBufferAfter) options. These can help you visualise delays or added minutes for tasks. For example travel time for meetings/appointments, check in/check out for flights.
Check out how you can style the events and the buffer areas in [this example](https://demo.mobiscroll.com/timeline/timeline-custom-event-rendering#) or just play with the slider below to see the differences.
### The event content
If you are looking to customize only the content and don't want to bother with the styling of the event, you can use the [renderScheduleEventContent](#renderer-renderScheduleEventContent) option. Mobiscroll will position the event to the right place and will render essential information like the color of the event, the time and if it's an all day event or not. The title, description and any other fields you want to show (like participants or an avatar) will be coming from your custom function.
Check out how you can style the event content in [this example](https://demo.mobiscroll.com/timeline/meal-planner#) or just play with the slider below to see the differences.
### The event slots
Use the [renderSlot](#renderer-renderSlot) option to customize the slot template of the Timeline view. Customize how the time slots look and what they show. Utilize properties passed in the [slots](#opt-slots) array. It takes a function that should return the desired markup. In the returned markup, you can use custom html as well.
Check out how you can style the slots in [this example](https://demo.mobiscroll.com/timeline/shift-template#) or just play with the slider below to see the differences.
### The timeline header
Customize how the header of the Timeline looks and how the components are arranged with the [renderHeader](#renderer-renderHeader) option. It takes a function that should return the desired markup. In the returned markup, you can use custom html as well as the built in header components of the calendar.
While fully customizing the header is very usefull, sometimes it's desireable to customize only parts of it. In this case you can take advantage of the default header's [building blocks](/javascript/eventcalendar/templating#header-templating). These components let you put toghether the header you want, while you don't have to worry about the functionality behind them.
Check out how you can style the Timeline header in [this example](https://demo.mobiscroll.com/timeline/switching-day-week-work-week-timeline) or just play with the slider below to see the differences.
### Variable event height
When using [event templating](./templating#event-templating), you might end up with various event heights, depending on the displayed content, e.g. larger description, list of tasks, etc.
By default this might not show up correctly, resulting in events overlapping each other.
You can enable support for variable event heights by setting the `eventHeight: 'variable'` property for the timeline inside the [`view`](./api#opt-view) option.
This will enable a new rendering mode. In case of large views, where virtual scrolling is used, the height of the rows might change dynamically
as new events are loaded into the view during scroll.

## API
Here is a comprehensive list of all the specific options, events and methods of the Timeline view.
### Options
Explore the following API options that help you easily configure the Timeline.
### 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](#opt-dragToCreate) option.
Using the [extendDefaultEvent](#opt-extendDefaultEvent) option extra properties can be set for the created event.
The event deletion functionality can be overwritten using the [eventDelete](#opt-eventDelete) option.
**Default value**: `undefined`
### colors
Array<[MbscCalendarColor](#type-MbscCalendarColor)>
Specifies the color for certain dates or date ranges on the calendar.
The [`MbscCalendarColor`](#type-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 color
- `end`: *string | object | Date* - Specifies the end date/time of a date/time range for the color
- `highlight`: *string* - Highlight color of the day, can be any valid CSS color (`'red'`, `'#ff0000'`, `'rgb(255, 0, 0)'`, etc.).
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring days.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Exception rule of the recurring rule.
Useful when recurring dates need to be skipped from the rule.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 color
- `textColor`: *string* - A color applied on the text.
- `title`: *string* - A title that will be displayed on the item.
:::info
The colored range will be considered all-day if:
- the `allDay` property is explicitly set.
- the `start` / `end` properties are not specified, only the `date`.
:::
:::info
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
:::
:::info
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
:::
:::info
The colors can be combined with the [labels](#opt-labels) or [marked](#opt-marked) options.
:::
```js
[
{ 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](#type-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-MbscEventConnection) type has the following properties:
- `arrow`: *boolean | "from" | "to" | "bidirectional"* - Specifies where to display arrows
If `true`, 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 begin
- `to`: *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](#type-MbscCalendarEvent)>
The events for the Eventcalendar.
The [`MbscCalendarEvent`](#type-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 event
- `cssClass`: *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 event
- `dragBetweenResources`: *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 event
- `id`: *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 the `eventOverlap`
property of the resource and the [eventOverlap](#opt-eventOverlap) option.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring events.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 the `eventResize` property of the resource and
the [dragToResize](#opt-dragToResize) option.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 event
- `textColor`: *string* - A color applied on the text.
- `timezone`: *string* - Timezone of the event
- `title`: *string* - The title of the event.
- `tooltip`: *string* - The tooltip text of the event.
:::info
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
:::
:::info
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
:::
:::info
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-onEventClick) event will receive the event object as argument, containing the custom properties as well.
:::
:::info
Use the [getEvents](#method-getEvents) method to get the events between two dates.
:::
```js
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.
:::info
When using timezones, the [exclusiveEndDates](#opt-exclusiveEndDates) option is also turned on by default.
:::
:::info
When using anything other than the default (`'local'`), a [timezone plugin](#opt-timezonePlugin)
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](https://gist.github.com/aviflax/a4093965be1cd008f172), e.g. `"America/New_York"`.
If not specified, it defaults to the [displayTimezone](#opt-displayTimezone).
**Default value**: `undefined`
### defaultSelectedDate
[MbscDateType](#type-MbscDateType)
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.
:::info
When using timezones, the [exclusiveEndDates](#opt-exclusiveEndDates) option is also turned on by default.
:::
:::info
When using anything other than the default (`'local'`), a [timezone plugin](#opt-timezonePlugin)
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](https://gist.github.com/aviflax/a4093965be1cd008f172), 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](#opt-dragInTime) option.
Consider that [dragToMove](#opt-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](#opt-dragInTime) option.
Consider that [dragToMove](#opt-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](#opt-dragBetweenResources) option.
Consider that [dragToMove](#opt-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](#opt-newEventText) option.
Using the [extendDefaultEvent](#opt-extendDefaultEvent) option extra properties can be set for the created event.
The event deletion functionality can be overwritten using the [eventDelete](#opt-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](#opt-clickToCreate) and [dragToCreate](#opt-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](#type-MbscCalendarEvent), event2: [MbscCalendarEvent](#type-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.
:::info
When using timezones, the `exclusiveEndDates` option will default to `true`.
:::
### extendDefaultEvent
(args: MbscNewEventData) => void | [MbscCalendarEvent](#type-MbscCalendarEvent)
Use this option to set properties to the new event created with click or drag.
The event creation is handled by the [clickToCreate](#opt-clickToCreate) and [dragToCreate](#opt-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.
```js
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`
### 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](#type-MbscDateType)> | Array<[MbscCalendarInvalid](#type-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* - 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* - Specifies the [resource](#opt-resources) 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](#opt-slots) 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.
:::info
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
:::
:::info
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
:::
```js
[
// 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-MbscCalendarInvalid) type has the following properties:
- `allDay`: *boolean* - If true the specified invalid will cover the whole day.
- `end`: *[MbscDateType](#type-MbscDateType)* - Specifies the end of the invalid range.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Recurrence rule for recurring invalid ranges.
- `recurringException`: *[MbscDateType](#type-MbscDateType) | Array<[MbscDateType](#type-MbscDateType)>* - Specifies recurring exceptions.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence exception rule.
Useful when recurring dates need to be skipped from the rule.
- `start`: *[MbscDateType](#type-MbscDateType)* - Specifies the start of the invalid range.
### invalidateEvent
"strict" | "start-end"
Specifies how to validate events against [invalid](#opt-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'`
### max
[MbscDateType](#type-MbscDateType)
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](#opt-invalid) option with daily recurrence starting from the specific date.
**Default value**: `undefined`
### min
[MbscDateType](#type-MbscDateType)
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](#opt-invalid) option with daily recurrence until the specific date.
**Default value**: `undefined`
### modules
Array
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.
```js
// import the print module
// later on, add it to the modules array:
modules: [print]
```
### refDate
[MbscDateType](#type-MbscDateType)
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](#opt-selectedDate) option.
**Default value**: `undefined`
### resources
Array<[MbscResource](#type-MbscResource)>
The scheduler and timeline views can handle multiple resources.
Resource grouping can be modified with the help of the [groupBy](#opt-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-MbscResource) type has the following properties:
- `background`: *string* - Specifies the background color of the resource row or column.
- `children`: *Array<[MbscResource](#type-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](#opt-dragBetweenResources) option.
- `eventDragBetweenSlots`: *boolean* - Specifies whether the events in this slot are movable across slots.
Has precedence over the [dragBetweenSlots](#opt-dragBetweenSlots) option.
- `eventDragInTime`: *boolean* - Specifies whether the events in this resource are movable in time.
Has precedence over the [dragInTime](#opt-dragInTime) option.
- `eventOverlap`: *boolean* - Specifies whether the events in this resource can be overlapped.
Has precedence over the [eventOverlap](#opt-eventOverlap) option.
- `eventResize`: *boolean* - Specifies whether the events in this resource are resizable.
Has precedence over the [dragToResize](#opt-dragToResize) option.
- `fixed`: *boolean* - Specifies whether the resource is fixed to the top.
It applies for timeline view if `resolutionVertical` in [view](#opt-view) option is not given, or it's value is set to `none`.
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 if `resourceReorder` in [view](#opt-view) option is enabled.
```js
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](#type-MbscResponsiveOptions)
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.
:::info
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: 0px
- `small` - min-width: 576px
- `medium` - min-width: 768px
- `large` - min-width: 992px
- `xlarge` - 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
[MbscDateType](#type-MbscDateType)
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](#opt-refDate) option.
You also need to pass a handler for the [onSelectedDateChange](#event-onSelectedDateChange) event
to update the selected date when the date is changed from the calendar.
**Default value**: `undefined`
### selectedEvents
Array<[MbscCalendarEvent](#type-MbscCalendarEvent)>
Specifies the selected events on the calendar. The [onSelectedEventsChange](#event-onSelectedEventsChange) event will be
fired when the selected events change from the calendar.
The [`MbscCalendarEvent`](#type-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 event
- `cssClass`: *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 event
- `dragBetweenResources`: *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 event
- `id`: *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 the `eventOverlap`
property of the resource and the [eventOverlap](#opt-eventOverlap) option.
- `recurring`: *string | [MbscRecurrenceRule](#type-MbscRecurrenceRule)* - Specifies a recurrence rule for handling recurring events.
- `recurringException`: *string | object | Date | Array* - Exception dates of the recurring rule.
Useful when specific dates need to be skipped from the rule.
- `recurringExceptionRule`: *string | [MbscRecurrenceRule](#type-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 the `eventResize` property of the resource and
the [dragToResize](#opt-dragToResize) option.
- `resource`: *string | number | Array* - In case of the timeline and scheduler view of the Eventcalendar, specifies the [resource](#opt-resources) 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](#opt-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 event
- `textColor`: *string* - A color applied on the text.
- `timezone`: *string* - Timezone of the event
- `title`: *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](#opt-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
Array<[MbscSlot](#type-MbscSlot)>
The slots, besides the [resources](#opt-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-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.
```js
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](../theming/sass-variables) or
[create custom themes](../theming/sass-themes).
:::info
Make sure that the theme you set is included in the downloaded package.
:::
**Default value**: `undefined`
### themeVariant
"auto" | "light" | "dark"
Controls which variant of the [theme](#opt-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'` or `undefined` - 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
[MbscTimezonePlugin](#type-MbscTimezonePlugin)
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](https://momentjs.com/timezone/)
and [luxon](https://moment.github.io/luxon/#/).
You can specify either the [dataTimezone](#opt-dataTimezone) or the [displayTimezone](#opt-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-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* -
### 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 Timeline 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.
### onCellClick
(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* - The events for the clicked date.
- `resource`: *string | number* - The id of the resource where the cell was clicked, if [resources](#opt-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.
### onCellDoubleClick
(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* - The events for the clicked date.
- `resource`: *string | number* - The id of the resource where the cell was clicked, if [resources](#opt-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.
### onCellHoverIn
(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* - The colors for the hovered cell.
- `date`: *Date* - The date of the hovered day.
- `events`: *Array* - The events for the hovered cell.
- `invalids`: *Array* - The invalid dates for the hovered cell.
- `labels`: *Array* - If the cell has labels, contains the label objects for the hovered cell.
- `marked`: *Array* - 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.
### onCellHoverOut
(args: MbscCellHoverEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer leaves a day on the calendar view (does not apply for agenda view).
Parameters:
- args - The event argument with the following properties:
- `colors`: *Array* - The colors for the hovered cell.
- `date`: *Date* - The date of the hovered cell.
- `events`: *Array* - The events for the hovered cell.
- `invalids`: *Array* - The invalid dates for the hovered cell.
- `labels`: *Array* - If the cell has labels, contains the label objects for the hovered cell.
- `marked`: *Array* - 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.
### onCellRightClick
(args: MbscCellClickEvent, inst: EventcalendarBase) => void
Triggered when a cell is right-clicked on the calendar, scheduler, or timeline grid .
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* - The events for the clicked date.
- `resource`: *string | number* - The id of the resource where the cell was clicked, if [resources](#opt-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.
### onDestroy
(args: any, inst: any) => void
Triggered when the component is destroyed.
Parameters:
- args - The event argument object.
- inst - The component instance.
### onEventClick
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when an event is clicked.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was clicked.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the click.
- `event`: *MbscCalendarEvent* - The clicked calendar event.
- `resource`: *string | number* - The id of the resource where the event was clicked, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was clicked, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was clicked, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was clicked, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was clicked.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventCreate
(args: MbscEventCreateEvent, inst: EventcalendarBase) => void
Triggered when an event is about to create and it is not yet rendered on its final position.
Event creation can be prevented by returning `false` from the handler function.
Parameters:
- args - The event argument with the following properties:
- `action`: *'click' | 'drag' | 'externalDrop'* - The action which created the event.
- `domEvent`: *Event* - The DOM event from the end of the gesture (mouseup or touchend).
- `event`: *MbscCalendarEvent* - The newly created event.
- `originEvent`: *MbscCalendarEvent* - The occurrence of the event which was dragged.
Will be set only if the event was created by dragging a recurring event occurrence.
- `resourceObj`: *MbscResource* - The resource where the event is being created, if [resources](#opt-resources) are set.
- `slotObj`: *MbscSlot* - The slot where the event is being created, if [slots](#opt-slots) are set.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event is being created.
- inst - The component instance.
### onEventCreateFailed
(args: MbscEventCreateFailedEvent, inst: EventcalendarBase) => void
Triggered when an event creation failed due to overlapping an invalid range or another event.
Parameters:
- args - The event argument with the following properties:
- `action`: *'click' | 'drag' | 'externalDrop'* - The action which created the event.
- `event`: *MbscCalendarEvent* - The newly created event.
- `invalid`: *object* - The invalid object which the event overlapped.
- `overlap`: *MbscCalendarEvent* - The overlapped event.
- `originEvent`: *MbscCalendarEvent* - The occurrence of the event which was dragged.
Will be set only if the event was created by dragging a recurring event occurrence.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event was created.
- inst - The component instance.
### onEventCreated
(args: MbscEventCreatedEvent, inst: EventcalendarBase) => void
Triggered when an event is created and it is rendered in its position.
Parameters:
- args - The event argument with the following properties:
- `action`: *'click' | 'drag' | 'externalDrop'* - The action which created the event.
- `event`: *MbscCalendarEvent* - The newly created event.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event was created.
- `target`: *HTMLElement* - The DOM element of the created event.
- `resourceObj`: *MbscResource* - The resource where the event is being created, if [resources](#opt-resources) are set.
- `slotObj`: *MbscSlot* - The slot where the event is being created, if [slots](#opt-slots) are set.
- inst - The component instance.
### onEventDelete
(args: MbscEventDeleteEvent, inst: EventcalendarBase) => void
Triggered when an event is about to be deleted and it is not yet removed from the view.
Event deletion can be performed with delete and backspace button on an active event.
Deletion can be prevented by returning `false` from the handler function.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event from of the keydown action.
- `event`: *MbscCalendarEvent* - The event being deleted.
- `events`: *Array* - The events being deleted in case of multiple event selection.
- `source`: *'agenda' | 'calendar' | 'timeline' | 'schedule'* - The view where the event is being deleted.
- inst - The component instance.
### onEventDeleted
(args: MbscEventDeletedEvent, inst: EventcalendarBase) => void
Triggered when an event is deleted and it is removed from the view.
Parameters:
- args - The event argument with the following properties:
- `event`: *MbscCalendarEvent* - The deleted event.
- `events`: *Array* - The deleted events in case of multiple event selection.
- `source`: *'agenda' | 'calendar' | 'timeline' | 'schedule'* - The view where the event was deleted.
- inst - The component instance.
### onEventDoubleClick
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when an event is double-clicked.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was clicked.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the click.
- `event`: *MbscCalendarEvent* - The clicked calendar event.
- `resource`: *string | number* - The id of the resource where the event was clicked, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was clicked, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was clicker, if [slots](#opt-slots) are set.
- `slotObj`: *MbscResource* - The resource where the event was clicker, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was clicked.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventDragEnd
(args: MbscEventDragEvent, inst: EventcalendarBase) => void
Triggered when an event drag has ended.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the drag.
- `event`: *MbscCalendarEvent* - The dragged calendar event.
- `resource`: *string | number* - The id of the resource where the event was dragged, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was dragged, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was dragged, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was dragged, if [slots](#opt-slots) are set.
- `source`: *'calendar' | 'schedule' | 'timeline'* - The view where the event was dragged.
- inst - The component instance.
### onEventDragEnter
(args: MbscEventDragEvent) => void
Triggered when an event is dragged into the calendar/timeline/schedule view.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the drag.
- `event`: *MbscCalendarEvent* - The dragged calendar event.
- `source`: *'calendar' | 'schedule' | 'timeline'* - The view where the event is dragged.
### onEventDragLeave
(args: MbscEventDragEvent) => void
Triggered when an event is dragged out form the calendar/timeline/schedule view.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event of the drag.
- `event`: *MbscCalendarEvent* - The dragged calendar event.
- `source`: *'calendar' | 'schedule' | 'timeline'* - The view where the event is dragged.
### onEventDragStart
(args: MbscEventDragEvent, inst: EventcalendarBase) => void
Triggered when an event drag has started.
Parameters:
- args - The event argument with the following properties:
- `action`: *'create' | 'resize' | 'move'* - The user action which triggered the event.
- `domEvent`: *Event* - The DOM event of the drag.
- `event`: *MbscCalendarEvent* - The dragged calendar event.
- `resource`: *string | number* - The id of the resource where the event is dragged, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event is dragged, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event is dragged, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event is dragged, if [slots](#opt-slots) are set.
- `source`: *'calendar' | 'schedule' | 'timeline'* - The view where the event is dragged.
- inst - The component instance.
### onEventHoverIn
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer hovers an event on the calendar.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event is hovered.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the hover.
- `event`: *MbscCalendarEvent* - The hovered calendar event.
- `resource`: *string | number* - The id of the resource where the event is hovered, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event is hovered, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event is hovered, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event is hovered, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event is hovered.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventHoverOut
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when the mouse pointer leaves an event on the calendar.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was hovered.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the hover.
- `event`: *MbscCalendarEvent* - The hovered calendar event.
- `resource`: *string | number* - The id of the resource where the event was hovered, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was hovered, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was hovered, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was hovered, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was hovered.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventRightClick
(args: MbscEventClickEvent, inst: EventcalendarBase) => void
Triggered when an event is right-clicked.
Parameters:
- args - The event argument with the following properties:
- `date`: *Date* - The date on which the event was clicked.
In case of the timeline view, this will be the first day of the event on the current view.
- `domEvent`: *Event* - The DOM event of the click.
- `event`: *MbscCalendarEvent* - The clicked calendar event.
- `resource`: *string | number* - The id of the resource where the event was clicked, if [resources](#opt-resources) are set.
- `resourceObj`: *MbscResource* - The resource where the event was clicked, if [resources](#opt-resources) are set.
- `slot`: *string | number* - The id of the slot where the event was clicked, if [slots](#opt-slots) are set.
- `slotObj`: *MbscSlot* - The slot where the event was clicked, if [slots](#opt-slots) are set.
- `source`: *'agenda' | 'calendar' | 'schedule' | 'timeline' | 'popover'* - The view where the event was clicked.
- `target`: *HTMLElement* - The DOM element of the event.
- inst - The component instance.
### onEventUpdate
(args: MbscEventUpdateEvent, inst: EventcalendarBase) => void
Triggered when an event is about to update. Update can be prevented by returning `false` from the handler function.
Parameters:
- args - The event argument with the following properties:
- `domEvent`: *Event* - The DOM event from the end of the gesture (mouseup or touchend).
- `event`: *MbscCalendarEvent* - The updated event.
- `events`: *Array* - The updated events.
It is set on recurring event delete, when [multiple event selection](#opt-selectMultipleEvents) is enabled.
- `newEvent`: *MbscCalendarEvent* - The newly created event.
Will be set only if the dragged event was a recurring event occurrence.
- `oldEvent`: *MbscCalendarEvent* - The original event before the update.
- `oldEvents`: *Array* - The original events before the update.
It is set on recurring event delete, when [multiple event selection](#opt-selectMultipleEvents) is enabled.
- `oldEventOccurrence`: *MbscCalendarEvent* - The occurrence of the event which was dragged.
Will be set only if the dragged event was a recurring event occurrence.
- `oldResource`: number | string - The id of the resource from which the event was dragged.
- `oldResourceObj`: *MbscResource* - The resource from which the event was dragged.
- `oldSlot`: number | string - The id of the slot from which the event was dragged.
- `oldSlotObj`: *MbscSlot* - The slot from which the event was dragged.
- `resource`: number | string - The id of the resource where the event was dropped.
- `resourceObj`: *MbscResource* - The resource where the event was dropped.
- `slot`: number | string - The id of the slot where the event was dropped.
- `slotObj`: *MbscSlot* - The slot where the event was dropped.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event is being updated.
- inst - The component instance.
### onEventUpdateFailed
(args: MbscEventUpdateFailedEvent, inst: EventcalendarBase) => void
Triggered when an event update failed due to overlapping an invalid range or another event.
Parameters:
- args - The event argument with the following properties:
- `event`: *MbscCalendarEvent* - The updated event.
- `invalid`: *object* - The invalid object which the event overlapped.
- `overlap`: *MbscCalendarEvent* - The overlapped event.
- `newEvent`: *MbscCalendarEvent* - The newly created event.
Will be set only if the dragged event was a recurring event occurrence.
- `oldEvent`: *MbscCalendarEvent* - The original event before the update.
- `oldEventOccurrence`: *MbscCalendarEvent* - The occurrence of the event which was dragged.
Will be set only if the dragged event was a recurring event occurrence.
- `source`: *'calendar' | 'timeline' | 'schedule'* - The view where the event was updated.
- inst - The component instance.
### onEventUpdated
(args: MbscEventUpdatedEvent, inst: EventcalendarBase) => void
Triggered when an event is updated and is rendered in its new position.
This is where you update the event in your database or persistent storage.
Parameters:
- args - The event argument with the following properties:
- `event`: *MbscCalendarEvent* - The updated event.
- `events`: *Array