Calendar

Angular Bootstrap 5 Calendar plugin

MDB calendar is a plugin that allows you to efficiently manage tasks. Thanks to this extension you will be able to easily create new events, manage current events, move existing events between other days, and store all data in an easily readable array.

Responsive Calendar plugin built with the Bootstrap 5, Angular 11 and Material Design 2.0. Various customization options like default view, event formats, customizable captions, and much more.

Note: Read the API tab to find all available options and advanced customization


Basic example

A few predefined events allowing you to see how the plugin looks like.


Event formats

Calendar events can be added with time in two different formats - 12h or 24h.


Monday first

Set the mondayFirst input to true so that Monday is the first day of the week.


Default view

Set the defaultView input to week or list to change the start view. By default, it is a month.


Twelve hour

By setting the twelveHours input to true, you get a 12-hour schedule.


Customize captions

You can customize all captions very easily using options input. Detailed options are described in the API tab.


Default date

A starting day can be easily set using the defaultDate input.


Readonly

The editable mode can be easily disabled using the readonly input.

Calendar - API


Import


        import { MdbCalendarModule } from 'mdb-angular-calendar';
        …
        @NgModule ({
          ...
          imports: [MdbCalendarModule],
          ...
        })
      

Inputs

Name Type Default Description
mondayFirst Boolean false Changes first day of week to monday.
defaultView String 'month' Defines default view.
twelveHour Boolean false Changes time mode from 24h to 12h.
defaultDate Date new Date() Defines the default starting date.
readonly Boolean false Disables event's edition.
events CalendarEvent[] - Array of calendar events

Options

Name Type Default Description
weekdays Array ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] Defines weekdays displayed names.
months Array ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] Defines months displayed names.
monthsShort Array ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] Defines shortened months displayed names.
todayCaption String 'today' Defines caption for today.
monthCaption String 'month' Defines caption for month button.
weekCaption String 'week' Defines caption for week button.
listCaption String 'list' Defines caption for list button.
allDayCaption String 'All day event' Defines caption for all day event checkbox.
noEventsCaption String 'No events' Defines caption for empty list view.
summaryCaption String 'Summary' Defines caption for summary input label.
descriptionCaption String 'Description' Defines caption for description input label.
startCaption String 'Start' Defines caption for start input label.
endCaption String 'End' Defines caption for end input label.
addCaption String 'Add' Defines caption for add event button.
deleteCaption String 'Remove' Defines caption for remove event button.
editCaption String 'Edit' Defines caption for edit event button.
closeCaption String 'Close' Defines caption for close button.
addEventModalCaption String 'Add an event' Defines caption for add event modal title.
editEventModalCaption String 'Edit an event' Defines caption for edit event modal title.

Outputs

Name Description
prev Emitted when the prev method triggers.
next Emitted when the next method triggers.
today Emitted when the today method triggers.
viewChanged Emitted when the changeView method triggers.
eventAdded Emitted when a new event is added. Returns a new event object.
eventEdited Emitted when any event is editted. Returns an editted event object.
eventDeleted Emitted when any event is deleted. Returns a deleted event object.

          <mdb-calendar [events]="events" (eventAdded)="onEventAdd($event)"></mdb-calendar>
        

          import { Component } from '@angular/core';

          @Component({
            selector: 'app-root',
            templateUrl: './app.component.html',
          })
          export class AppComponent {
            onEventAdd(event): void {
              console.log(event);
            }
          }        
        

Methods

Name Parameters Description
prevPeriod - Changes the period of time to previous.
nextPeriod - Changes the period of time to next.
todayPeriod - Changes the period of time to today.
changeView view Changes the view.
addEvent MdbCalendarEvent Adds new event to the calendar.
removeEvents - Removes all events from the calendar.

        <mdb-calendar #calendar [events]="events"></mdb-calendar>

        <button class="btn btn-primary" (click)="removeEvents()">Remove all events</button>
      

        import { Component, ViewChild } from '@angular/core';
        import { MdbCalendarComponent } from 'mdb-angular-calendar';
        
        @Component({
          selector: 'app-root',
          templateUrl: './app.component.html',
        })
        export class AppComponent {
          @ViewChild('calendar', { static: true }) calendar: MdbCalendarComponent;
        
          nextPeriod(): void {
            this.calendar.removeEvents();
          }
        }