Event Calendar for Javascript

Learn about Event Calendar

Responsive event calendar with month view, variable week view, range view and event listing.

Supporting one-time, recurring, all-day and multi-day events with pop-over and schedule listing capability. Use it for mobile, desktop and responsive websites.

Shipping with useful features for a refined UX, including:

  • Usage on mobile and desktop with responsive features
  • Single and multi-day events
  • One-time and recurring events
  • Daily, weekly, monthly and custom event schedules
  • Month view, week view and range view
  • Liquid layout with inline display mode
  • Pop-over event listing or list view for schedule
  • Multiple theme support
  • RTL support
  • Full localization


Interested in calendar views? Other demos that could be useful:

Calendar Range


Event calendar demos available for other frameworks.

Viewing demos & code for

light
dark

Change the theme setting here

Event Calendar - Mobile month view

Change demo
Mobile month view

Use the event calendar for mobile, desktop and everything in-between. The content perfectly fills the parent container or the mobile screen in full width. You can chooose to render an agenda-view below the calendar broken up into days ordered chronologically. For more ways to customize the agenda view check out this example.

Interested to see how the event calendar looks on largers screens?  Check out the next demo →
var inst = mobiscroll.eventcalendar('#demo-mobile-month-view', {
    lang: '',
    theme: '',
    display: 'inline',
    view: {
        calendar: { type: 'month' },
        eventList: { type: 'month' }
    }
});

mobiscroll.util.getJson('https://trial.mobiscroll.com/events/', function (events) {
    inst.setEvents(events);
}, 'jsonp');
<div id="demo-mobile-month-view"></div>

Event Calendar - Desktop month view

Change demo
Desktop month view

Depending on the screen width the calendar seamlesly transforms into a desktop-view using the available space more intelligently. The main difference between the mobile and desktop rendering is how the day cells are laid out. People can now see on a glance how many events a day holds and by clicking on day the event list will show up in a pop-over.

Interested to see how the event calendar looks on smaller screens?  Check out the previous demo →
var inst = mobiscroll.eventcalendar('#demo-desktop-month-view', {
    lang: '',
    theme: '',
    display: 'inline',
    showEventCount: true,
    calendarHeight: 614
});

mobiscroll.util.getJson('https://trial.mobiscroll.com/events/', function (events) {
    inst.setEvents(events);
}, 'jsonp');
<div id="demo-desktop-month-view"></div>

Event Calendar - Responsive

Change demo
Responsive

The event calendar is fully responsive. It adapts to the available space and fills the screen to look good everywhere. While the you don't have to worry about the width the height can be manually adjusted with the calendarHeight property.

var inst = mobiscroll.eventcalendar('#demo-responsive-month-view', {
    lang: '',
    theme: '', 
    display: 'inline',
    calendarHeight: 513,
    view: {
            calendar: {
                labels: true,
                popover: true
            }
        }
});

mobiscroll.util.getJson('https://trial.mobiscroll.com/events/', function (events) {
    inst.setEvents(events);
}, 'jsonp');
<div id="demo-responsive-month-view"></div>

Event Calendar - Variable weeks

Change demo
Variable weeks

The calendar view supports variable weeks. Save space by only displaying one or two weeks or go for a full month where it makes sense. Use the weeks setting that expects a number of rows. The default is six weeks, but feel free to play around.

mobiscroll.settings = {
    lang: '',
    theme: ''
};

var one, two, three;

one = mobiscroll.eventcalendar('#demo-one-week-view', {
    display: 'inline',
    view: {
        calendar: { type: 'week' }
    }
});

two = mobiscroll.eventcalendar('#demo-two-week-view', {
    display: 'inline',
    view: {
        calendar: { type: 'week', size: 2 }
    }
});

three = mobiscroll.eventcalendar('#demo-three-week-view', {
    display: 'inline',
    view: {
        calendar: { type: 'week', size: 3 }
    }
});

mobiscroll.util.getJson('https://trial.mobiscroll.com/events/', function (events) {
    one.setEvents(events);
    two.setEvents(events);
    three.setEvents(events);
}, 'jsonp');
<div mbsc-form>
    <div class="mbsc-grid">
        <div class="mbsc-row">
            <div class="mbsc-col-sm-12 mbsc-col-md-4">
                <div class="mbsc-form-group">
                    <div class="mbsc-form-group-title">One week view</div>
                    <div id="demo-one-week-view"></div>
                </div>
            </div>
            <div class="mbsc-col-sm-12 mbsc-col-md-4">
                <div class="mbsc-form-group">
                    <div class="mbsc-form-group-title">Two week view</div>
                    <div id="demo-two-week-view"></div>
                </div>
            </div>
            <div class="mbsc-col-sm-12 mbsc-col-md-4">
                <div class="mbsc-form-group">
                    <div class="mbsc-form-group-title">Three week view</div>
                    <div id="demo-three-week-view"></div>
                </div>
            </div>
        </div>
    </div>
</div>

Event Calendar - Compact daily schedule

Change demo
Compact daily schedule

Use a compact week calendar that you can place at the top of your screen and list a daily schedule below. The calendar view is configured with the calendar object (take a look the previous example) while the agenda view is configured by the eventList setting. For more details on the agenda view see this example. Both are set up inside the view setting.

Days with events are marked with a little dot and days without any events have a localized empty view. Btw. the components are completely localized. Go on and check out this example.

var inst = mobiscroll.eventcalendar('#demo-daily-events', {
    lang: '',
    theme: '',
    display: 'inline',
    view: {
        calendar: { type: 'week' },
        eventList: { type: 'day' }
    }
});

mobiscroll.util.getJson('https://trial.mobiscroll.com/events/', function (events) {
    inst.setEvents(events);
}, 'jsonp');
<div id="demo-daily-events"></div>

Event Calendar - Switching views

Change demo
Switching views

Dynamically switch views within one calendar instance. Use a UI control to let users do the switching or do it programatically.

The example features a month view with full event schedule, a week view with a weekly schedule and daily event list. Use the option method to dynamically change the settings.

Interested in building more complex views?  See how to synchronize a calendar and a separate event list →
mobiscroll.settings = {
    lang: '',
    theme: ''
};

var now = new Date(),
    calendar = mobiscroll.eventcalendar('#demo', {
        display: 'inline',
        view: {
            calendar: { type: 'month' },
            eventList: { type: 'month' }
        },
        onInit: function (event, inst) {
                mobiscroll.util.getJson('https://trial.mobiscroll.com/events/', function (events) {
                    inst.setEvents(events);
                }, 'jsonp');
            }
    });

document.querySelectorAll('.md-view-change').forEach(function (elm) {
    elm.addEventListener('change', function (ev) {
        switch (ev.target.value) {
            case 'month':
                calendar.option({
                    view: {
                        calendar: { type: 'month' },
                        eventList: { type: 'month' }
                    }
                })
                break;
            case 'week':
                calendar.option({
                    view: {
                        calendar: { type: 'week' },
                        eventList: { type: 'week' }
                    }
                })
                break;
            case 'day':
                calendar.option({
                    view: {
                        eventList: { type: 'day' }
                    }
                })
                break;
        }
    });
});
<div mbsc-form>
    <div class="mbsc-form-group">
        <div class="mbsc-form-group-title">Month, week and day view</div>
        <label>
            Month
            <input type="radio" data-role="segmented" name="view" value="month" class="md-view-change" checked>
        </label>
        <label>
            Week
            <input type="radio" data-role="segmented" name="view" value="week" class="md-view-change">
        </label>
        <label>
            Day
            <input type="radio" data-role="segmented" name="view" value="day" class="md-view-change">
        </label>
        <div id="demo"></div>
    </div>
</div>

Event Calendar - Agenda view

Change demo
Agenda view

Use the eventList object, configurable inside the view setting to render a scrollable schedule or agenda view. type and size can be set:

  • day - eventList: { type: 'day', size: 20 } can be configured for a single day or a range of days
  • week - eventList: { type: 'week', size: 3 } can be configured for a single week or a range
  • month - eventList: { type: 'month' } can be configured for a single month or a range
Interested in combining this with a calendar view?  Check out the previous example →
mobiscroll.settings = {
    lang: '',
    theme: ''
};

var daily, weekly, monthly;

daily = mobiscroll.eventcalendar('#demo-agenda-daily', {
    display: 'inline',
    view: {
        eventList: { type: 'day' }
    }
});

weekly = mobiscroll.eventcalendar('#demo-agenda-weekly', {
    display: 'inline',
    view: {
        eventList: { type: 'week' }
    }
});

monthly = mobiscroll.eventcalendar('#demo-agenda-monthly', {
    display: 'inline',
    view: {
        eventList: { type: 'month' }
    }
});

mobiscroll.util.getJson('https://trial.mobiscroll.com/events-new/', function (events) {
    daily.setEvents(events);
    weekly.setEvents(events);
    monthly.setEvents(events);
}, 'jsonp');
<div mbsc-form>
    <div class="mbsc-grid">
        <div class="mbsc-row">
            <div class="mbsc-col-sm-12 mbsc-col-md-4">
                <div class="mbsc-form-group">
                    <div class="mbsc-form-group-title">Daily schedule</div>
                    <div id="demo-agenda-daily"></div>
                </div>
            </div>
            <div class="mbsc-col-sm-12 mbsc-col-md-4">
                <div class="mbsc-form-group">
                    <div class="mbsc-form-group-title">Weekly schedule</div>
                    <div id="demo-agenda-weekly"></div>
                </div>
            </div>
            <div class="mbsc-col-sm-12 mbsc-col-md-4">
                <div class="mbsc-form-group">
                    <div class="mbsc-form-group-title">Monthly schedule</div>
                    <div id="demo-agenda-monthly"></div>
                </div>
            </div>
        </div>
    </div>
</div>

Event Calendar - Synchronized views

Change demo
Synchronized views

You can usually get away with using a single event calendar instance, but being able to use and synchronize multiple views can come in handy.

In this example we have a two-pane layout with a calendar view on the left and a large agenda view on the right. Because the default rendering of agenda below the calendar doesn't fit we'll be needing two instances. The sync has to happen for both. The day view calls the navigate method of the calendar in its onPageChange event, while the calendar sets the day view with navigate from its onSetDate event.

var monthInst,
    dayInst,
    preventSet;

dayInst = mobiscroll.eventcalendar('#demo-day', {
    lang: '',
    theme: '',
    display: 'inline',
    view: {
        eventList: { type: 'day' }
    },
    onPageChange: function (event, inst) {
        preventSet = true;
        navigate(monthInst, event.firstDay);
    }
});

monthInst = mobiscroll.eventcalendar('#demo-month', {
    lang: '',
    theme: '',
    display: 'inline',
    view: {
        calendar: { type: 'month' }
    },
    onSetDate: function (event, inst) {
        if (!preventSet) {
            navigate(dayInst, event.date);
        }
        preventSet = false;
    }
});

function navigate(inst, val) {
    if (inst) {
        inst.navigate(val);
    }
}

mobiscroll.util.getJson('https://trial.mobiscroll.com/events/', function (events) {
    dayInst.setEvents(events);
    monthInst.setEvents(events);
}, 'jsonp');
<div class="mbsc-grid md-demo-synchronized-views">
    <div class="mbsc-row mbsc-no-padding">
        <div class="mbsc-col-md-4 mbsc-col-12">
            <div id="demo-month"></div>
        </div>
        <div class="mbsc-col-md-8 mbsc-col-12 md-col-right">
            <div id="demo-day"></div>
        </div>
    </div>
</div>
.md-demo-synchronized-views {
    position: absolute;
    height: 100%;
}

.md-demo-synchronized-views .mbsc-row {
    height: 100%;
}

.md-demo-synchronized-views .md-col-right {
    overflow: auto;
    height: 100%;
    border-left: 1px solid #ccc;
}

Event Calendar - Marked, colored & labels

Change demo
Marked, colored & labels

For additional information you can mark days with colored dots, add labels or completely color the background of the days. This offers means to add more information to the calendar that is valuable to users. Take a look at this example of marked days and description.

You can add these with exact dates, ranges, days of week, days of month and recurring dates. When processing a lot of data you can load the marked days, labels, colors dynamically in the onMonthChange event.

Want to show event data and use multiple labels?  We have an example for that →
// Use the settings object to change the theme
mobiscroll.settings = {
    lang: '',
    theme: ''
};

var now = new Date();

mobiscroll.form('#md-form');

mobiscroll.eventcalendar('#demo-marked', {
    display: 'inline',
    marked: [
        { d: '5/1', color: '#ffc400' },
        { d: '12/24', color: '#ffee00' },
        { d: '12/25', color: 'red' },
        { d: new Date(now.getFullYear(), now.getMonth() + 1, 4) },
        { d: new Date(now.getFullYear(), now.getMonth() - 2, 13) },
        { d: new Date(now.getFullYear(), now.getMonth(), 2), color: '#46c4f3' },
        { d: new Date(now.getFullYear(), now.getMonth(), 6), color: '#7e56bd' },
        { d: new Date(now.getFullYear(), now.getMonth(), 11), color: '#7e56bd' },
        { d: new Date(now.getFullYear(), now.getMonth(), 19), color: '#89d7c9' },
        { d: new Date(now.getFullYear(), now.getMonth(), 28), color: '#ea4986' },
        { d: new Date(now.getFullYear(), now.getMonth(), 13), color: '#7e56bd' },
        { d: new Date(now.getFullYear(), now.getMonth(), 13), color: '#f13f77' },
        { d: new Date(now.getFullYear(), now.getMonth(), 13), color: '#89d7c9' },
        { d: new Date(now.getFullYear(), now.getMonth(), 13), color: '#8dec7d' },
        { d: new Date(now.getFullYear(), now.getMonth(), 21), color: '#ffc400' },
        { d: new Date(now.getFullYear(), now.getMonth(), 21), color: '#8dec7d' },
        { start: new Date(now.getFullYear(), now.getMonth() + 1, 15), end: new Date(now.getFullYear(), now.getMonth() + 1, 18), color: '#f4511e' }
    ]
});

mobiscroll.eventcalendar('#demo-colored', {
    display: 'inline',
    colors: [
        { d: '12/8', background: '#9ccc65' },
        { d: '5/1', background: 'red' },
        { d: '12/24', background: "#fff568" },
        { d: '12/25', background: "#e88080" },
        { d: new Date(now.getFullYear(), now.getMonth() + 1, 4), background: '#cfd8dc' },
        { d: new Date(now.getFullYear(), now.getMonth() + 2, 24), background: '#9575cd' },
        { d: new Date(now.getFullYear(), now.getMonth() - 2, 13), background: '#d4e157' },
        { d: new Date(now.getFullYear(), now.getMonth() - 1, 6), background: "#f4511e" },
        { d: new Date(now.getFullYear(), now.getMonth() + 1, 6), background: '#46c4f3' },
        { d: new Date(now.getFullYear(), now.getMonth() + 1, 22), background: '#7e56bd' },
        { d: new Date(now.getFullYear(), now.getMonth() - 1, 11), background: '#46c4f3' },
        { d: new Date(now.getFullYear(), now.getMonth() - 1, 29), background: '#7e56bd' },
        { d: new Date(now.getFullYear(), now.getMonth(), 2), background: '#46c4f3' },
        { d: new Date(now.getFullYear(), now.getMonth(), 3), background: '#7e56bd' },
        { d: new Date(now.getFullYear(), now.getMonth(), 11), background: '#f13f77' },
        { d: new Date(now.getFullYear(), now.getMonth(), 19), background: '#8dec7d' },
        { d: new Date(now.getFullYear(), now.getMonth(), 28), background: '#ea4986' },
        { start: new Date(now.getFullYear(), now.getMonth() + 1, 15), end: new Date(now.getFullYear(), now.getMonth() + 1, 18), text: 'Conference', background: '#f4511e' }
    ]
});

mobiscroll.eventcalendar('#demo-labels', {
    display: 'inline',
    labels: [
        { d: '12/25', text: 'Christmas', color: "#f48fb1" },
        { d: '1/1', text: 'New year' },
        { d: '12/1', text: 'Meeting', color: '#ffc400' },
        { d: new Date(now.getFullYear(), now.getMonth() + 1, 4), text: 'Spa day', color: '#cfd8dc' },
        { d: new Date(now.getFullYear(), now.getMonth() + 2, 24), text: 'BD Party', color: '#9ccc65' },
        { d: new Date(now.getFullYear(), now.getMonth() - 2, 13), text: 'Exams', color: '#d4e157' },
        { d: new Date(now.getFullYear(), now.getMonth() - 1, 6), text: 'Trip', color: "#f4511e" },
        { d: new Date(now.getFullYear(), now.getMonth() + 1, 6), color: '#46c4f3', text: 'Pizza Night' },
        { d: new Date(now.getFullYear(), now.getMonth() + 1, 22), color: '#7e56bd', text: 'Beerpong' },
        { d: new Date(now.getFullYear(), now.getMonth() - 1, 11), color: '#46c4f3', text: 'Anniversary' },
        { d: new Date(now.getFullYear(), now.getMonth() - 1, 29), color: '#7e56bd', text: 'Pete BD' },
        { d: new Date(now.getFullYear(), now.getMonth(), 2), color: '#46c4f3', text: 'Ana BD' },
        { d: new Date(now.getFullYear(), now.getMonth(), 3), color: '#7e56bd', text: 'Concert' },
        { d: new Date(now.getFullYear(), now.getMonth(), 11), color: '#f13f77', text: 'Trip' },
        { d: new Date(now.getFullYear(), now.getMonth(), 19), color: '#8dec7d', text: 'Math exam' },
        { d: new Date(now.getFullYear(), now.getMonth(), 28), color: '#ea4986', text: 'Party' },
        { start: new Date(now.getFullYear(), now.getMonth() + 1, 15), end: new Date(now.getFullYear(), now.getMonth() + 1, 18), text: 'Conference', color: '#f4511e' }
    ]
});
<div mbsc-form>
    <div class="mbsc-grid">
        <div class="mbsc-row">
            <div class="mbsc-col-sm-12 mbsc-col-md-4">
                <div class="mbsc-form-group">
                    <div class="mbsc-form-group-title">Marked days</div>
                    <div id="demo-marked"></div>
                </div>
            </div>
            <div class="mbsc-col-sm-12 mbsc-col-md-4">
                <div class="mbsc-form-group">
                    <div class="mbsc-form-group-title">Colored days</div>
                    <div id="demo-colored"></div>
                </div>
            </div>
            <div class="mbsc-col-sm-12 mbsc-col-md-4">
                <div class="mbsc-form-group">
                    <div class="mbsc-form-group-title">Labels</div>
                    <div id="demo-labels"></div>
                </div>
            </div>
        </div>
    </div>
</div>

Event Calendar - Events as labels

Change demo
Events as labels

Events can be displayed a couple of different ways. Most of the time showing the event data inside and across the calendar cells is the way to go.

When configuring the calendar object, you can set labels: true. All of this happens under the view setting.

Rather show events in a pop-over?  Take a look at the next example →
var inst = mobiscroll.eventcalendar('#demo-events-labels', {
    lang: '',
    theme: '',
    display: 'inline',
    calendarHeight: 614,
    view: {
        calendar: {
            labels: true
        }
    }
});

mobiscroll.util.getJson('https://trial.mobiscroll.com/events/', function (events) {
    inst.setEvents(events);
}, 'jsonp');
<div id="demo-events-labels"></div>

Event Calendar - Events in popover

Change demo
Events in popover

Besides displaying event labels or listing them in an agenda view, you can have them show up in a pop-over. Set it up though the calendar: {popover: true} object inside the view setting. Using the popover setting saves vertical space and provides a subtle cue to the user that there are events. A small dot will apear in day cells with events.

Would a full-blown event list help?  Take a look at the next example →
var inst = mobiscroll.eventcalendar('#demo-event-popover', {
    lang: '',
    theme: '',
    display: 'inline'
});

mobiscroll.util.getJson('https://trial.mobiscroll.com/events/', function (events) {
    inst.setEvents(events);
}, 'jsonp');
<div id="demo-event-popover"></div>

Event Calendar - Events in agenda view

Change demo
Events in agenda view

The calendar view ships with two methods for listing events. Either as event labels or in a pop-over. Besides these two the third way is to configure an event list under the view setting.

Configure the event list like this view: {eventList: {type: 'month'}}.

Looking for more options for event lists?  Try the daily/weekly/monthly schedule →
var inst = mobiscroll.eventcalendar('#demo', {
    lang: '',
    theme: '',
    display: 'inline',
    view: {
        calendar: { type: 'month' },
        eventList: { type: 'month' }
    }
});

mobiscroll.util.getJson('https://trial.mobiscroll.com/events/', function (events) {
    inst.setEvents(events);
}, 'jsonp');
<div class="mbsc-grid-fixed mbsc-grid-md">
    <div id="demo"></div>
</div>

Event Calendar - Custom event data

Change demo
Custom event data

If you want to display complex event data, you can do it by passing HTML as the text. This can be full fledged HTML with a layout, CSS, styling, emojis and so on.

When the events are renderend, instead of just plain text, the component will print the styled HTML markup. Besides that the layout, time will be kept the same as with plain text. If you have something completely different in mind, you can use the listview to render the events instead of relying on the event calendar agenda view. Psst... the listview supports slide gestures.

Have a different event list in mind?  Use the listview with gestures →
var now = new Date();

mobiscroll.eventcalendar('#demo', {
    lang: '',
    theme: '',
    display: 'inline',
    view: {
        calendar: { type: 'month' },
        eventList: { type: 'month' }
    },
    cssClass: 'md-custom-data',
    data: [{
        d: new Date(now.getFullYear(), now.getMonth(), 8, 8, 0),
        text: 'Green box to post office',
        color: '#6e7f29',
    }, {
        start: new Date(now.getFullYear(), now.getMonth(), 8, 8, 45),
        end: new Date(now.getFullYear(), now.getMonth(), 8, 9, 0),
        text: 'Quick mtg. with Martin <div class="mbsc-bold md-event-desc">Deal offer</div><div class="md-event-loc mbsc-txt-muted"><span class="mbsc-ic mbsc-ic-location"></span>13 Walnut Avenue, Eden Hazelton</div><span class="md-event-emoji">🎉</span>',
        color: '#de3d83',
        category: 'meeting',
        location: '13 Walnut Avenue, Eden Hazelton'
    }, {
        start: new Date(now.getFullYear(), now.getMonth(), 8, 9, 30),
        end: new Date(now.getFullYear(), now.getMonth(), 8, 10, 30),
        text: 'Product team mtg. <div class="mbsc-bold md-event-desc">Promote Justin</div><div class="md-event-loc mbsc-txt-muted"><span class="mbsc-ic mbsc-ic-location"></span>Office</div><span class="md-event-emoji">💬</span>',
        color: '#f67944',
        category: 'meeting',
        location: 'Office'
    }, {
        start: new Date(now.getFullYear(), now.getMonth(), 8, 11, 0),
        end: new Date(now.getFullYear(), now.getMonth(), 8, 11, 30),
        text: 'Stakeholder mtg. <div class="md-event-loc mbsc-txt-muted"><span class="mbsc-ic mbsc-ic-location"></span>Office</div><span class="md-event-emoji">💬</span>',
        color: '#f67944',
        category: 'meeting',
        location: 'Office'
    }, {
        start: new Date(now.getFullYear(), now.getMonth(), 8, 13, 0),
        end: new Date(now.getFullYear(), now.getMonth(), 8, 13, 30),
        text: 'Pick up Kate <div class="mbsc-bold md-event-desc">Lunch @ Butcher\'s</div><div class="md-event-loc mbsc-txt-muted"><span class="mbsc-ic mbsc-ic-location"></span>38 Hardman Road, Cedar Court</div><span class="md-event-emoji">🍔</span>',
        color: '#00aabb',
        category: 'date',
        location: '38 Hardman Road, Cedar Court'
    }, {
        start: new Date(now.getFullYear(), 9, 9, 9),
        text: 'Coffee with Steve <div class="md-event-loc mbsc-txt-muted"><span class="mbsc-ic mbsc-ic-location"></span>1334 Rose Street, Walpole</div><span class="md-event-emoji">☕</span>',
        color: '#00aabb',
        category: 'coffee break',
        location: '1334 Rose Street, Walpole'
    }, {
        start: new Date(now.getFullYear(), 10, 2, 12),
        text: 'Trip to England <div class="mbsc-bold md-event-desc">Family visit</div><div class="md-event-loc mbsc-txt-muted"><span class="mbsc-ic mbsc-ic-location"></span>Evergreen Drive</div><span class="md-event-emoji">✈</span>',
        color: '#00aabb',
        category: 'vacation',
        location: 'Evergreen Drive'
    }, {
        start: new Date(now.getFullYear(), 4, 3, 11),
        end: new Date(now.getFullYear(), 4, 3, 12),
        text: 'Photoshoot <div class="md-event-loc mbsc-txt-muted"><span class="mbsc-ic mbsc-ic-location"></span>431 Durham Road, Indianapolis</div><span class="md-event-emoji">📸</span>',
        color: '#00aabb',
        category: 'hobby',
        location: '431 Durham Road, Indianapolis'
    }, {
        start: new Date(now.getFullYear(), now.getMonth(), 17, 30, 0),
        text: 'Shopping with mom <div class="mbsc-bold md-event-desc">List on the fridge</div><div class="md-event-loc mbsc-txt-muted"><span class="mbsc-ic mbsc-ic-location"></span>587 Grant Street, Montpelier</div><span class="md-event-emoji">🛒</span>',
        color: '#f67944',
        category: 'hobby',
        location: '587 Grant Street, Montpelier'
    }, {
        d: (now.getMonth() + 1) + '/14',
        text: 'Dexter BD <div class="md-event-loc mbsc-txt-muted"><span class="mbsc-ic mbsc-ic-location"></span>52 Crescent Street, Phoenix</div><span class="md-event-emoji">🎂</span>',
        color: '#37bbe4',
        category: 'party',
        location: '52 Crescent Street, Phoenix'
    }, {
        d: (now.getMonth() + 1) + '/5',
        text: 'Luke BD <div class="mbsc-bold md-event-desc">Party at 4 PM</div><div class="md-event-loc mbsc-txt-muted"><span class="mbsc-ic mbsc-ic-location"></span>57 Mulberry Street, Fremont</div><span class="md-event-emoji">🎉</span>',
        color: '#37bbe4',
        category: 'birthday',
        location: '57 Mulberry Street, Fremont'
    }, {
        d: 'w3',
        text: 'Employment <div class="mbsc-bold md-event-desc">Semi-weekly</div><div class="md-event-loc mbsc-txt-muted"><span class="mbsc-ic mbsc-ic-location"></span>Office</div><span class="md-event-emoji">✍</span>',
        color: '#635045',
        category: 'meeting',
        location: 'Office'
    }, {
        d: 'w5',
        text: 'Employment <div class="mbsc-bold md-event-desc">Semi-weekly</div><div class="md-event-loc mbsc-txt-muted"><span class="mbsc-ic mbsc-ic-location"></span>Office</div><span class="md-event-emoji">✍</span>',
        color: '#ff9966',
        category: 'meeting',
        location: 'Office'
    }, {
        start: new Date(now.getFullYear(), 1, 7),
        end: new Date(now.getFullYear(), 1, 25),
        text: 'Dean OFF <div class="mbsc-bold md-event-desc">Vacation</div><span class="md-event-emoji">🌄</span>',
        color: '#99ff33',
        category: 'vacation'
    }, {
        start: new Date(now.getFullYear(), 2, 1),
        end: new Date(now.getFullYear(), 2, 14),
        text: 'Mike probation time <div class="mbsc-bold md-event-desc">Jack\'s supervision</div><div class="md-event-loc mbsc-txt-muted"><span class="mbsc-ic mbsc-ic-location"></span>Office</div><span class="md-event-emoji">📋</span>',
        color: '#e7b300',
        category: 'work',
        location: 'Office'
    }, {
        start: new Date(now.getFullYear(), 4, 7),
        end: new Date(now.getFullYear(), 4, 16),
        text: 'John OFF <div class="mbsc-bold md-event-desc">Sick leave</div><span class="md-event-emoji">💊</span>',
        color: '#669900',
        category: 'sickness',
    }, {
        start: new Date(now.getFullYear(), 5, 1),
        end: new Date(now.getFullYear(), 5, 11),
        text: 'Carol OFF <div class="mbsc-bold md-event-desc">Personal problems</div>',
        color: '#6699ff',
        category: 'vacation'
    }, {
        start: new Date(now.getFullYear(), 6, 2),
        end: new Date(now.getFullYear(), 6, 17),
        text: 'Business trip <div class="md-event-loc mbsc-txt-muted"><span class="mbsc-ic mbsc-ic-location"></span>5th Street North</div><span class="md-event-emoji">🚌</span>',
        color: '#cc9900',
        category: 'vacation',
        location: '5th Street North'
    }, {
        start: new Date(now.getFullYear(), 7, 6),
        end: new Date(now.getFullYear(), 7, 14),
        text: 'Ashley OFF <div class="mbsc-bold md-event-desc">On a trip</div><span class="md-event-emoji">🚌</span>',
        color: '#339966',
        category: 'vacation'
    }, {
        start: new Date(now.getFullYear(), 8, 10),
        end: new Date(now.getFullYear(), 8, 20),
        text: 'Marisol OFF <div class="mbsc-bold md-event-desc">Family time</div><span class="md-event-emoji">👨‍‍👧‍👦</span>',
        color: '#8701a9',
        category: 'vacation'
    }, {
        start: new Date(now.getFullYear(), 9, 1),
        end: new Date(now.getFullYear(), 9, 4),
        text: 'Sharon OFF <div class="mbsc-bold md-event-desc">Sick leave</div><span class="md-event-emoji">🤕</span>',
        color: '#cc6699',
        category: 'sickness'
    }, {
        d: '12/25',
        text: 'Christmas Day <div class="md-event-loc mbsc-txt-muted"><span class="mbsc-ic mbsc-ic-location"></span>Home</div><span class="md-event-emoji">🎄</span>',
        color: '#ff0066',
        category: 'holiday',
        location: 'Home'
    }, {
        d: '1/1',
        text: 'New Year\'s day <span class="md-event-emoji">🎆</span>',
        color: '#99ccff',
        category: 'holiday'
    }, {
        d: '4/1',
        text: 'April Fool\'s Day <div class="mbsc-bold md-event-desc">Just kidding!</div><span class="md-event-emoji">🤡</span>',
        color: '#ff6666',
        category: 'joke'
    }, {
        d: '11/2',
        text: 'File Form 720 for the third quarter <span class="md-event-emoji">📃</span>',
        color: '#a63e14',
        category: 'work'
    }]
});
<div id="demo"></div>
.md-custom-data .mbsc-event-txt {
    line-height: 1.3em;
}

.md-event-loc {
    padding-top: .5em;
    font-size: 12px;
}

.md-event-emoji {
    position: absolute;
    top: 19px;
    right: 15px;
    font-size: 14px;
}

.md-event-desc+.md-event-loc+.md-event-emoji {
    top: 30px;
}

.md-event-loc .mbsc-ic-location {
    margin-right: 5px;
}

Event Calendar - Custom rendering with listview

Change demo
Custom rendering with listview

While we have flexible event listing, sometimes you might need something entirely different. For those situations we have the listview.

You will be passing the events to the calendar like before, but the event listing will be handled externally. Use the Event API to query the events and create any layout you desire. The listview is super-useful to render anything that is a list and it event supports gestures, so you can do things like swipe away to remove an event. Try swiping the events left and right.

Do you want to keep the aganda view and customize the content?  Pass HTML as the event text →
mobiscroll.settings = {
    lang: '',
    theme: ''
};

var ul = document.getElementById('demo-listview-rendering-data'),
    cal,
    list,
    buttons,
    events = [],
    star = document.createElement('span'),
    formatDate = mobiscroll.util.datetime.formatDate;

star.className = 'mbsc-ic mbsc-ic-star3 md-listview-rendering-icon';

list = mobiscroll.listview('#demo-listview-rendering-data', {
    context: '#demo-listview-rendering-data',
    stages: {
        left: [{
            color: '#55ad55',
            text: 'Interested',
            confirm: true,
            action: function (event, inst) {
                var el = event.target.getElementsByClassName('md-listview-rendering-icon')[0];

                el.classList.remove('md-hide-star');

                mobiscroll.toast({
                    message: 'Interested'
                });
            }
        }],
        right: [{
            color: '#b93838',
            text: 'Not Interested',
            confirm: true,
            action: function (event, inst) {
                var id = event.target.getAttribute('data-id'),
                    index = events.findIndex(item => item.id == id);

                // remove event from listview
                inst.remove(id, 'left', function () {
                    // remove event from events array
                    events.splice(index, 1);
                    // remove event from calendar
                    cal.removeEvent([id - 1]);
                });

                mobiscroll.toast({
                    message: 'Not Interested'
                });
            }
        }]
    }
});

cal = mobiscroll.eventcalendar('#demo-listview-rendering', {
    display: 'inline',
    firstDay: 1,
    view: {
        calendar: {
            type: 'week'
        }
    },
    onPageLoaded: function (event, inst) {
        var first = event.firstDay,
            last = new Date(first.getFullYear(), first.getMonth(), first.getDate() + 7);

        getEvents(first, last);
    },
    onPosition: function (event, inst) {
        var eventList = document.getElementsByClassName('md-demo-listview-rendering')[0],
            top = eventList.getBoundingClientRect().top + document.body.scrollTop;

        setTimeout(function () {
            eventList.style.height = window.innerHeight - top + 'px';
        });
    },
    onDayChange: function (event, inst) {
        // find all day headers
        var headers = ul.querySelectorAll('li[data-role="list-divider"]'),
            formattedDate = formatDate('yy/mm/dd', event.date),
            day;

        for (var i = 0; i < headers.length; i++) {
            if (headers[i].innerHTML == formattedDate) {
                day = headers[i];
            }
        }

        if (day !== undefined) {
            setTimeout(function () {
                day.scrollIntoView({ behavior: 'smooth', block: 'start' });
            });
        }
    }
});

mobiscroll.util.getJson('https://trial.mobiscroll.com/events-listview/', function (arr) {
    events = arr;
    cal.setEvents(events);
}, 'jsonp');

function getEvents(first, last) {
    var i, item, cards, curr, prev,
        dividers = ul.querySelectorAll('li[data-role="list-divider"]'),
        btn = '<button class="mbsc-btn mbsc-btn-filled mbsc-btn-info md-listview-rendering-btn">View</button>';

    list.settings.animation = false;

    // remove all events
    for (i = 0; i < events.length; ++i) {
        list.remove(events[i].id);
    }

    // remove dividers
    for (i = 0; i < dividers.length; ++i) {
        list.remove(dividers[i]);
    }

    // add current events
    for (i = 0; i < events.length; ++i) {
        item = events[i];
        item.d = item.divider ? new Date(item.date) : new Date(item.d);

        if (item.d >= first && item.d < last) {
            curr = item.d.getDay();
            prev = events[i - 1] ? events[i - 1].d.getDay() : -1;

            // add divider if needed
            if (curr != prev) {
                list.add('divider-' + i, mobiscroll.$('<li data-role="list-divider">' + formatDate('yy/mm/dd', item.d) + '</li>'));
            }

            list.add(item.id,
                '<div class="md-listview-rendering-content">' +
                '<div class="md-listview-rendering-date">' + formatDate('D d M h:iia', item.d) + '</div>' + btn +
                '<div class="md-listview-rendering-title mbsc-bold">' + item.title +
                '<span class="mbsc-ic mbsc-ic-star3 md-listview-rendering-icon ' + (!item.starred ? 'md-hide-star' : '') + '"></span>' + '</div>' +
                '<div class="md-listview-rendering-loc mbsc-italic">' + item.loc + '</div>' +
                '</div>' +
                '<div class="md-listview-rendering-card">' +
                '<img src="https://img.mobiscroll.com/demos/' + item.img + '" draggable="false">' +
                '</div>'
            );
        }
    }
    cards = ul.getElementsByClassName('md-listview-rendering-card');
    mobiscroll.card(cards);

    list.settings.animation = true;
}

ul.addEventListener('click', function (e) {
    if (e.target.classList.contains('md-listview-rendering-btn')) {
        mobiscroll.toast({
            message: 'View clicked'
        });
    }
});
<div class="md-listview-rendering-data">
    <div id="demo-listview-rendering"></div>
    <div class="md-demo-listview-rendering">
        <ul id="demo-listview-rendering-data" class="mbsc-cloak"></ul>
    </div>
</div>
.md-listview-rendering-content {
    padding: 16px 16px 0;
    position: relative;
}

.md-listview-rendering-date {
    font-size: 15px;
    color: #5e5e5e;
    margin-bottom: 6px;
}

.md-listview-rendering-title {
    font-size: 18px;
    margin-bottom: 4px;
}

.md-hide-star {
    display: none;
}

.md-listview-rendering-icon {
    color: #e0e040;
    margin: 0 6px;
}

.md-listview-rendering-loc {
    font-size: 14px;
    color: #5e5e5e;
}

.md-listview-rendering-img {
    max-width: 100%;
}

.md-listview-rendering-data .mbsc-lv-ic-s {
    color: #e0e040;
}

.md-listview-rendering-data .md-listview-rendering-btn {
    position: absolute;
    right: 12px;
    top: 21px;
    z-index: 1;
    transition: background-color .3s ease-out;
}

.md-listview-rendering-data .md-demo-listview-rendering {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

Event Calendar - Date types

Change demo
Date types

The event calendar support multiple data types. The data, marked, colors and labels objects all understand the different formats. Let's see how they look:

  • JS date objects - new Date(1995, 11, 17, 15, 24)
  • ISO date strings - '2008-09-15T15:53:00'
  • Localized date strings - '04/25/2010 8:15 AM'
  • Moment.js objects - moment([2018, 3, 27, 12, 15])
mobiscroll.settings = {
    lang: '',
    theme: '',
    display: 'inline'
};

var obj, iso, momentJs;

obj = mobiscroll.eventcalendar('#demo-date-type-obj', { showEventCount: true });
iso = mobiscroll.eventcalendar('#demo-date-type-iso', { showEventCount: true });
momentJs = mobiscroll.eventcalendar('#demo-date-type-moment', { showEventCount: true });

document
    .getElementById('addDate')
    .addEventListener('click', function () {
        obj.addEvent({
            start: new Date(2019, 4, 8, 10, 45),
            end: new Date(2019, 4, 8, 11, 45),
            text: 'New Event'
        });
        obj.navigate(new Date(2019, 4, 8));
    }, false);

document
    .getElementById('addISO')
    .addEventListener('click', function () {
        iso.addEvent({
            start: '2019-09-15T15:30:00',
            end: '2019-09-15T16:00:00',
            text: 'New Event'
        });
        iso.navigate('2019-09-15');
    }, false);

document
    .getElementById('addMoment')
    .addEventListener('click', function () {
        // make sure that moment js is loaded
        momentJs.addEvent({
            start: moment([2019, 3, 20, 18]),
            end: moment([2019, 3, 20, 20]),
            text: 'New Event'
        });
        momentJs.navigate(moment([2019, 3, 20]));
    }, false);
<div mbsc-form>
    <div class="mbsc-grid">
        <div class="mbsc-row">
            <div class="mbsc-col-sm-12 mbsc-col-md-4">
                <div class="mbsc-form-group">
                    <div class="mbsc-form-group-title">Date object</div>
                    <div class="mbsc-btn-group-block">
                        <button id="addDate" class="mbsc-btn-primary">start: new Date(2019, 4, 8, 10, 45) <br /> end: new Date(2019, 4, 8, 11, 45)</button>
                    </div>
                    <div id="demo-date-type-obj"></div>
                </div>
            </div>
            <div class="mbsc-col-sm-12 mbsc-col-md-4">
                <div class="mbsc-form-group">
                    <div class="mbsc-form-group-title">ISO string</div>
                    <div class="mbsc-btn-group-block">
                        <button id="addISO" class="mbsc-btn-primary">start: 2019-09-15T15:30:00 <br /> end: 2019-09-15T16:00:00</button>
                    </div>
                    <div id="demo-date-type-iso"></div>
                </div>
            </div>
            <div class="mbsc-col-sm-12 mbsc-col-md-4">
                <div class="mbsc-form-group">
                    <div class="mbsc-form-group-title">Moment js</div>
                    <div class="mbsc-btn-group-block">
                        <button id="addMoment" class="mbsc-btn-primary">start: moment([2019, 3, 20, 18]) <br /> end: moment([2019, 3, 20, 20])</button>
                    </div>
                    <div id="demo-date-type-moment"></div>
                </div>
            </div>
        </div>
    </div>
</div>

Event Calendar - Event data structure

Change demo
Event data structure

The event data structure for is straightforward with a couple of base properties that the component understands and uses to render the UI. Besides the base properties you can add any custom property, like location, description ...

  • text - Defines the event text. This can be plaintext or HTML
  • color - Defines the event color
  • start - Sets the start date and time for the event. It can be a date object, ISO date string or moment.js object
  • end - Sets the end date and time for the event. The same formats are supported as for start

This is how a simple event looks like with a couple of extra properties:

{
    text: 'Product planning',
    color: '#56ca70',
    start: new Date(2018, 11, 21, 13, 00),
    end: new Date(2018, 11, 21, 14, 00),
    busy: true,
    description: 'Weekly meeting with team',
    location: 'Office'
}

mobiscroll.settings = {
    lang: '',
    theme: ''
};


var inst = mobiscroll.eventcalendar('#demo-data-structure', {
    display: 'inline'
});

document
    .getElementById('data-str-btn')
    .addEventListener('click', function () {
        inst.addEvent({
            text: 'Sarah OFF',
            color: '#56ca70',
            start: new Date(2018, 11, 21, 13, 00),
            end: new Date(2018, 11, 21, 14, 00),
            busy: true,
            description: 'Sick leave',
            location: 'Home'
        });
    }, false);
<div mbsc-form>
    <div class="mbsc-grid">
        <div class="mbsc-row mbsc-justify-content-center">
            <div class="mbsc-col-sm-12 mbsc-col-md-5">
                <div class="mbsc-form-group">
                    <div class="mbsc-form-group-title">Base properties</div>
                    <label>
                        Text
                        <input id="data-str-text" value="Sarah OFF" disabled />
                    </label>
                    <label>
                        Color
                        <input id="data-str-color" value="#56ca70" disabled />
                    </label>
                    <label>
                        Start
                        <input id="data-str-start" value="12/21/2018" disabled />
                    </label>
                    <label>
                        End
                        <input id="data-str-end" value="12/21/2018" disabled />
                    </label>
                </div>
                <div class="mbsc-form-group">
                    <div class="mbsc-form-group-title">Add any property you'd like</div>
                    <label>
                        Busy
                        <input id="data-str-busy" value="false" disabled />
                    </label>
                    <label>
                        Description
                        <input id="data-str-desc" value="Sick leave" disabled />
                    </label>
                    <label>
                        Location
                        <input id="data-str-loc" value="Home" disabled />
                    </label>
                </div>
                <button id="data-str-btn">Add event</button>
            </div>
            <div class="mbsc-col-sm-12 mbsc-col-md-5">
                <div class="mbsc-form-group">
                    <div class="mbsc-form-group-title">Event calendar</div>
                    <div id="demo-data-structure"></div>
                </div>
            </div>
        </div>
    </div>
</div>

Event Calendar - Events from remote API

Change demo
Events from remote API

Data sources for the event calendar include inline data, you can load all events at once from an external resource or load data on demand. This example shows how to use an external API to load the data from. The same JSON format applies for the events, but it's base properties and optional fields. The previous demo shows what data format to follow. More information about the data setting can be seen in the documentation.

Looking for load on demand?  Dynamically load events on month change →
var inst = mobiscroll.eventcalendar('#demo-remote-api', {
    lang: '',
    theme: '',
    display: 'inline',
    view: {
        calendar: { type: 'month' },
        eventList: { type: 'month' }
    }
});

mobiscroll.util.getJson('https://trial.mobiscroll.com/events/', function (events) {
    inst.setEvents(events);
}, 'jsonp');
<div id="demo-remote-api"></div>

Event Calendar - Loading events on demand

Change demo
Loading events on demand

The calendar supports remote and local data sources. Besides that, events can be populated on initialization or loaded on demand. Getting the events in real time as the user navigates improves load performance and always serves the most recent data.

Use the onPageLoading lifecycle event to load the data when needed.

Interested in pre-loading event data all at once?  Load events from a remote API →
mobiscroll.eventcalendar('#demo', {
    lang: '',
    theme: '',
    display: 'inline',
    view: {
        calendar: { type: 'month' },
        eventList: { type: 'month' }
    },
    onPageLoading: function (event, inst) {
        var year = event.firstDay.getFullYear(),
            month = event.firstDay.getMonth();

        mobiscroll.util.getJson('https://trial.mobiscroll.com/monthlyevents/?year=' + year + '&month=' + month, function (data) {
            var events = [];

            for (var i = 0; i < data.length; i++) {
                events.push({
                    start: data[i].start,
                    end: data[i].end,
                    d: data[i].d,
                    text: data[i].text,
                    color: data[i].color
                });
            }

            inst.setEvents(events);
        }, 'jsonp');
    }
});
<div id="demo"></div>

Event Calendar - Loading from Google calendar

Change demo
Loading from Google calendar
Javascript Event calendar demo with google calendar sync. Load events dynamically from multiple google calendars. Plain JS api for usage everywhere.
// Load the SDK asynchronously
function loadGoogleSDK() {
    (function (d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) {
            return;
        }
        js = d.createElement(s);
        js.id = id;
        js.src = "//apis.google.com/js/client.js?onload=onGoogleLoad";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'google-jssdk'));
}

function onGoogleLoad() {
    gapi.auth.init(function () {});
}

function getEventProps(event, calId) {
    return {
        start: event.start.date || event.start.dateTime,
        end: ((new Date(event.end.date) - new Date(event.start.date)) / 86400000 == 1 ? '' : event.end.date) || event.end.dateTime,
        text: event.summary || 'No Title',
        calendarId: calId,
        color: eventColors[event.colorId] || calColors[calId]
    };
}

var clientId = '<YOUR_CLIENT_ID>',
    eventColors = {},
    calColors = {},
    calIds = {},
    calInst,
    formInst,
    calApiLoaded,
    firstDay,
    lastDay;

loadGoogleSDK();

formInst = mobiscroll.form('#demo-google-cal-form');

calInst = mobiscroll.eventcalendar('#demo-google-cal', {
    theme: '',
    lang: '',
    display: 'inline',
    view: {
        calendar: {
            labels: true
        }
    },
    data: [],
    onPageLoading: function (event) {
        var year = event.firstDay.getFullYear(),
            month = event.firstDay.getMonth();

        firstDay = new Date(year, month - 1, -7);
        lastDay = new Date(year, month + 2, 14);

        if (calApiLoaded) {
            var batch = gapi.client.newBatch();
            for (var id in calIds) {
                batch.add(gapi.client.calendar.events.list({
                    'calendarId': id,
                    'timeMin': firstDay.toISOString(),
                    'timeMax': lastDay.toISOString()
                }), { id: id });
            }
            if (Object.getOwnPropertyNames(calIds).length !== 0) {
                batch.then(function (resp) {
                    var eventList = [],
                        res = resp.result;
                    for (var r in res) {
                        var events = res[r].result.items;
                        for (var i = 0; i < events.length; ++i) {
                            eventList.push(getEventProps(events[i], r));
                        }
                    }
                    calInst.setEvents(eventList);
                });
            }
        }
    }
});

// Google auth
document.getElementById('demo-google-auth')
    .addEventListener('click', function (ev) {
        if (!calApiLoaded) {
            gapi.auth.authorize({
                client_id: clientId,
                scope: 'https://www.googleapis.com/auth/calendar',
                immediate: false
            }).then(function (authResult) {
                // Load the calendar API
                if (authResult) {
                    return gapi.client.load('calendar', 'v3');
                }
            }).then(function () {
                calApiLoaded = true;
                ev.target.style.display = 'none';
                // Load calendar colors
                return gapi.client.calendar.colors.get({
                    'fields': 'event'
                });
            }).then(function (resp) {
                var ev = resp.result.event;
                for (var i = 0; i < ev.length; ++i) {
                    eventColors[i] = ev[i].color.background;
                }
                // Load calendar list
                return gapi.client.calendar.calendarList.list({
                    'fields': 'items(backgroundColor,colorId,description,id,summary)'
                });
            }).then(function (resp) {
                // Populate the calendar list
                var html = '',
                    cals = resp.result.items;
                for (var i = 0; i < cals.length; ++i) {
                    var cal = cals[i];
                    calColors[cal.id] = cal.backgroundColor;
                    html += '<label>' +
                        '<input data-role="switch" type="checkbox" class="md-cal-sync" data-calendar-id="' + cal.id + '">' +
                        cal.summary +
                        '<span class="mbsc-desc">' +
                        (cal.description || 'No description') + '</span>' +
                        '</label>';
                }
                document.getElementById('demo-google-cal-list').innerHTML = html;
                formInst.refresh();
            }).catch(function (err) {
                // TODO test for more errors
                mobiscroll.toast({
                    message: err.error
                });
            });
        }
    });

document.addEventListener('change', function (e) {
    if (e.target.classList.contains('md-cal-sync')) {

        var calId = event.target.getAttribute('data-calendar-id');

        if (e.target.checked) {
            // Add events from this calendar
            calIds[calId] = true;
            gapi.client.calendar.events.list({
                'calendarId': calId,
                'timeMin': firstDay.toISOString(),
                'timeMax': lastDay.toISOString()
            }).then(function (resp) {
                var eventList = [],
                    events = resp.result.items;
                for (var i = 0; i < events.length; ++i) {
                    eventList.push(getEventProps(events[i], calId));
                }
                calInst.addEvent(eventList);
            });
        } else {
            // Remove events from this calendar
            var i,
                eventList = calInst.getEvents(),
                eventsToRemove = [];

            for (i = 0; i < eventList.length; i++) {
                if (eventList[i].calendarId == calId) {
                    eventsToRemove.push(eventList[i]._id);
                }
            }

            calInst.removeEvent(eventsToRemove);

            delete calIds[calId];
        }
        return false;
    }
});
<div id="demo-google-cal-form">
    <div class="mbsc-grid">
        <div class="mbsc-row">
            <div class="mbsc-col-sm-12 mbsc-col-md-4">
                <div class="mbsc-form-group">
                    <button id="demo-google-auth" class="mbsc-btn-block">Add Google Calendars</button>
                    <div id="demo-google-cal-list"></div>
                </div>
            </div>
            <div class="mbsc-col-sm-12 mbsc-col-md-8">
                <div class="mbsc-form-group">
                    <div id="demo-google-cal"></div>
                </div>
            </div>
        </div>
    </div>
</div>

Event Calendar - Add/delete event

Change demo
Add/delete event

The component renders event data that it gets from an API, however you can manually add and delete events in real time. The idea is to pass the event in the correct format, which means it needs a couple of base properties:

  • d or start & end - Defines the date and length of the event
  • text - Defines the lable for the event, which can be anythng from text to something more complex like HTML
  • color - Defines the color of the event
  • allDay - Sets if the event is an all-day event or not
  • everything else you would like - You can add any additional data that makes sense, like busy or location...

After you have the data object ready with the event data you can pass it to the addEvent method. While the event calendar doesn't ship with a built-in form for adding events, you can use the popup component along with inputs & fields to build the form you need.

Deleting events can be done just as simply by calling the removeEvent method

mobiscroll.settings = {
    lang: '',
    theme: ''
};

var monthInst,
    dayInst,
    popupInst,
    dateInst,
    preventSet,
    allDaySwitch = document.getElementById('allDay'),
    eventTextInput = document.getElementById('eventText'),
    eventDescInput = document.getElementById('eventDesc'),
    now = new Date(),
    btn = '<button class="mbsc-btn mbsc-btn-outline mbsc-btn-danger md-delete-btn">Delete</button>',
    myData = [{
            start: new Date(now.getFullYear(), now.getMonth(), 8, 13),
            end: new Date(now.getFullYear(), now.getMonth(), 8, 13, 30),
            text: 'Lunch @ Butcher\'s' + btn,
            color: '#26c57d'
        }, {
            start: new Date(now.getFullYear(), now.getMonth(), now.getDate(), 15),
            end: new Date(now.getFullYear(), now.getMonth(), now.getDate(), 16),
            text: 'General orientation' + btn,
            color: '#fd966a'
        }, {
            start: new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1, 18),
            end: new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1, 22),
            text: 'Dexter BD' + btn,
            color: '#37bbe4'
        }, {
            start: new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 10, 30),
            end: new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 11, 30),
            text: 'Stakeholder mtg.' + btn,
            color: '#d00f0f'
        }];

function navigate(inst, val) {
    if (inst) {
        inst.navigate(val);
    }
}

dateInst = mobiscroll.range('#eventDate', {
    controls: ['date', 'time'],
    dateWheels: '|D M d|',
    endInput: '#endInput',
    tabs: false,
    responsive: {
        large: {
            touchUi: false
        }
    },
    cssClass: 'md-add-event-range'
});

dayInst = mobiscroll.eventcalendar('#demo-add-event-day', {
    display: 'inline',
    view: {
        eventList: { type: 'day' }
    },
    data: myData,
    onPageChange: function (event, inst) {
        var day = event.firstDay;
        preventSet = true;
        navigate(monthInst, day);
        dateInst.setVal([day, new Date(day.getFullYear(), day.getMonth(), day.getDate(), day.getHours() + 2)], true);
    },
    onEventSelect: function (event, inst) {
        if (event.domEvent.target.classList.contains('md-delete-btn')) {
            mobiscroll.confirm({
                title: 'Confirm Deletion',
                message: 'Are you sure you want to delete this item?',
                okText: 'Delete',
                callback: function (res) {
                    if (res) {
                        inst.removeEvent([event.event._id]);
                        monthInst.removeEvent([event.event._id]);
                        mobiscroll.toast({
                            message: 'Deleted'
                        });
                    }
                }
            });
        }
    }
});

monthInst = mobiscroll.eventcalendar('#demo-add-event-month', {
    display: 'inline',
    view: {
        calendar: { type: 'month' }
    },
    data: myData,
    onSetDate: function (event, inst) {
        if (!preventSet) {
            var day = event.date;
            navigate(dayInst, day);
            dateInst.setVal([day, new Date(day.getFullYear(), day.getMonth(), day.getDate(), day.getHours() + 2)], true);
        }
        preventSet = false;
    }
});

document
    .getElementById('allDay')
    .addEventListener('change', function () {
        var allDay = this.checked;

        dateInst.option({
            controls: allDay ? ['date'] : ['date', 'time'],
            dateWheels: (allDay ? 'MM dd yy' : '|D M d|')
        });
    });

popupInst = mobiscroll.popup('#demo-add-event-popup', {
    display: 'center',
    cssClass: 'mbsc-no-padding',
    buttons: [{
            text: 'Add event',
            handler: 'set'
        },
        'cancel'
    ],
    headerText: 'Add new event',
    onSet: function (event, inst) {
        var eventDates = dateInst.getVal(),
            events = {
                start: eventDates[0],
                end: eventDates[1],
                text: (eventTextInput.value || 'New Event') + btn,
                title: eventTextInput.value || 'New Event',
                description: eventDescInput.value,
                allDay: allDaySwitch.checked,
                free: document.querySelector('input[name="free"]:checked').value == 'true'
            };
        monthInst.addEvent(events);
        dayInst.addEvent(events);
        eventTextInput.value = '';
        eventDescInput.value = '';
        // Navigate the calendar to the new event's start date
        monthInst.navigate(eventDates[0], true);
    }
});

document
    .getElementById('showAddEventPopup')
    .addEventListener('click', function () {
        popupInst.show();
    }, false);
<div mbsc-form>
    <div class="mbsc-grid md-add-event-demo">
        <div class="mbsc-row mbsc-no-padding">
            <div class="mbsc-col-md-4 mbsc-col-12">
                <div id="demo-add-event-month"></div>
                <div class="mbsc-btn-group-block">
                    <button id="showAddEventPopup">Add New Event</button>
                </div>
            </div>
            <div class="mbsc-col-md-8 mbsc-col-12 md-col-right">
                <div id="demo-add-event-day"></div>
            </div>
        </div>
    </div>
</div>

<div id="demo-add-event-popup" class="md-add-event-popup">
    <div mbsc-form>
        <div class="mbsc-form-group">
            <label>
                Title
                <input id="eventText">
            </label>
            <label>
                Description
                <textarea id="eventDesc"></textarea>
            </label>
        </div>
        <div class="mbsc-form-group">
            <label for="allDay">
                All-day
                <input id="allDay" type="checkbox" data-role="switch">
            </label>
            <label for="eventDate">
                Starts
                <input id="eventDate">
            </label>
            <label>
                Ends
                <input id="endInput">
            </label>
            <label>
                Show as busy
                <input type="radio" data-role="segmented" name="free" value="false" checked>
            </label>
            <label>
                Show as free
                <input type="radio" data-role="segmented" name="free" value="true">
            </label>
        </div>
    </div>
</div>
.md-add-event-demo {
    position: absolute;
    height: 100%;
}

.md-add-event-demo .mbsc-row {
    height: 100%;
}

.md-add-event-demo .md-col-right {
    overflow: auto;
    height: 100%;
    border-left: 1px solid #ccc;
}

.md-add-event-demo .md-delete-btn {
    margin: 0;
    position: absolute;
    right: 10px;
    top: 8px;
    z-index: 1;
    transition: background-color .3s ease-out;
}

.mbsc-material .md-add-event-demo .md-delete-btn {
    top: 6px;
}

.mbsc-windows .md-add-event-demo .md-delete-btn {
    top: 10px;
}

.md-add-event-demo .md-delete-btn.mbsc-btn-outline.mbsc-btn:not(:disabled):not(.mbsc-active):hover:hover {
    background: #f5504e;
    color: #fff;
}

.mbsc-rtl .md-add-event-demo .md-delete-btn {
    right: auto;
    left: 10px;
}

.md-add-event-popup {
    max-width: 400px;
}

Event Calendar - View/update event

Change demo
View/update event

This demo renders event data that it gets from an API, however you can update events. You can find and load the event by ID into a form and then pass it back to the calendar on Save. Edit the fields:

  • d or start & end - Defines the date and length of the event - Use the range picker
  • text - Defines the lable for the event, which can be anythng from text to something more complex like HTML
  • color - Defines the color of the event - use the color picker
  • allDay - Sets if the event is an all-day event or not
  • everything else you would like - You can add any additional data that makes sense, like busy or location...

After you have the new data object ready with the event data you can pass it to the calendar. While the event calendar doesn't ship with a built-in form for adding/editing events, you can use the popup component along with inputs & fields to build the form you need.

mobiscroll.settings = {
    lang: '',
    theme: ''
};

var popupInst,
    calInst,
    listInst,
    rangeInst,
    colorInst,
    preventSet,
    eventToEdit,
    allDaySwitch = document.getElementById('allDay'),
    eventTextInput = document.getElementById('eventText'),
    eventDescInput = document.getElementById('eventDesc'),
    btn = '<button class="mbsc-btn mbsc-btn-outline mbsc-btn-primary md-edit-btn">Edit</button>';

function saveChanges() {
    var eventToSave = {
        _id: eventToEdit._id,
        text: eventTextInput.value + btn,
        desc: eventDescInput.value,
        color: colorInst.getVal(),
        allDay: allDaySwitch.checked,
        start: rangeInst.getVal()[0],
        end: rangeInst.getVal()[1],
        free: document.querySelector('input[name="free"]:checked').value == 'true'
    };

    calInst.updateEvent(eventToSave);
    listInst.updateEvent(eventToSave);
}

function updatePopup() {
    var event = eventToEdit,
        free = event.free ? true : false,
        oneDay = 1000 * 60 * 60 * 24,
        diff = new Date(event.end).getTime() - new Date(event.start).getTime(),
        days = Math.round(Math.abs(diff) / oneDay),
        allDay = event.allDay || days > 0;

    eventTextInput.value = event.text.replace(btn, '');
    eventDescInput.value = event.desc || '';
    allDaySwitch.checked = allDay;
    rangeInst.setVal([event.start, event.end], true);
    rangeInst.option({
        controls: allDay ? ['date'] : ['date', 'time'],
        dateWheels: (allDay ? 'MM dd yy' : '|D M d|')
    });
    document.querySelector('input[name="free"][value=' + free + ']').checked = true;
    colorInst.setVal(event.color, true);
}

function navigate(inst, val) {
    if (inst) {
        inst.navigate(val);
    }
}

popupInst = mobiscroll.popup('#demo-view-update-popup', {
    display: 'center',
    buttons: [
        'cancel',
        {
            text: 'Save',
            handler: 'set'
        }
    ],
    headerText: 'Edit event',
    onSet: function (event, inst) {
        saveChanges();
    }
});

rangeInst = mobiscroll.range('#eventDate', {
    controls: ['date', 'time'],
    dateWheels: '|D M d|',
    endInput: '#endInput',
    tabs: false,
    responsive: {
        large: {
            touchUi: false
        }
    }
});

calInst = mobiscroll.eventcalendar('#demo-view-update-event', {
    display: 'inline',
    view: {
        calendar: {
            type: 'month'
        }
    },
    onSetDate: function (event, inst) {
        if (!preventSet) {
            var day = event.date;
            navigate(listInst, day);
        }
        preventSet = false;
    }
});

listInst = mobiscroll.eventcalendar('#demo-view-update-event-list', {
    display: 'inline',
    view: {
        eventList: { type: 'day' }
    },
    onPageChange: function (event, inst) {
        var day = event.firstDay;
        preventSet = true;
        navigate(calInst, day);
    },
    onEventSelect: function (event, inst) {
        if (event.domEvent.target.classList.contains('md-edit-btn')) {
            eventToEdit = event.event;
            updatePopup();
            popupInst.show();
        }
    }
});

colorInst = mobiscroll.color('#eventColor', {
    display: 'inline',
    clear: false,
    data: ['#fff568', '#ffc400', '#ff5252', '#f48fb1', '#ba68c8', '#8c9eff', '#90caf9', '#9ccc65', '#0db057', '#bcaaa4']
});

document
    .getElementById('allDay')
    .addEventListener('change', function () {
        var allDay = this.checked;

        rangeInst.option({
            controls: allDay ? ['date'] : ['date', 'time'],
            dateWheels: (allDay ? 'MM dd yy' : '|D M d|')
        });
    });

mobiscroll.util.getJson('https://trial.mobiscroll.com/events-update/', function (events) {
    for (var i = 0; i < events.length; ++i) {
        events[i].text += btn;
    }
    calInst.setEvents(events);
    listInst.setEvents(events);
}, 'jsonp');
<div mbsc-form>
    <div class="mbsc-grid md-view-update-demo">
        <div class="mbsc-row mbsc-no-padding">
            <div class="mbsc-col-md-4 mbsc-col-12">
                <div id="demo-view-update-event"></div>
            </div>
            <div class="mbsc-col-md-8 mbsc-col-12 md-col-right">
                <div id="demo-view-update-event-list"></div>
            </div>
        </div>
    </div>
</div>

<div id="demo-view-update-popup" class="md-view-update-popup">
    <div mbsc-form>
        <div class="mbsc-form-group">
            <label>
                Title
                <input id="eventText">
            </label>
            <label>
                Description
                <textarea id="eventDesc"></textarea>
            </label>
        </div>
        <div class="mbsc-form-group">
            <label for="allDay">
                All-day
                <input id="allDay" type="checkbox" data-role="switch">
            </label>
            <label for="eventDate">
                Starts
                <input id="eventDate">
            </label>
            <label>
                Ends
                <input id="endInput">
            </label>
            <label>
                Show as busy
                <input type="radio" data-role="segmented" name="free" value="false">
            </label>
            <label>
                Show as free
                <input type="radio" data-role="segmented" name="free" value="true">
            </label>
            <div id="eventColor"></div>
        </div>
    </div>
</div>
.md-view-update-demo {
    position: absolute;
    height: 100%;
}

.md-view-update-demo .mbsc-row {
    height: 100%;
}

.md-view-update-demo .md-col-right {
    overflow: auto;
    height: 100%;
    border-left: 1px solid #ccc;
}

.md-view-update-popup {
    max-width: 400px;
}

.md-hidden .mbsc-color-input {
    display: none;
}

.md-view-update-demo .md-edit-btn {
    margin: 0;
    position: absolute;
    right: 10px;
    top: 8px;
    z-index: 1;
    transition: background-color .3s ease-out;
}

.mbsc-material .md-view-update-demo .md-edit-btn {
    top: 6px;
}

.mbsc-windows .md-view-update-demo .md-edit-btn {
    top: 10px;
}

.md-view-update-demo .md-edit-btn.mbsc-btn-outline.mbsc-btn:not(:disabled):not(.mbsc-active):hover:hover {
    background: #3f97f6;
    color: #fff;
}

.mbsc-rtl .md-view-update-demo .md-edit-btn {
    right: auto;
    left: 10px;
}

Event Calendar - Calendar systems

Change demo
Calendar systems

The event calendar supports multiple calendar systems. You can control it with the calendarSystem setting, and it supports the following options:

  • Gregorian - it is included by default
  • Jalali - it is the default system of the Persian calendar and is inlcuded within the Farsi language pack
  • Hijri - it is included in the Arabic language pack
Interested in localization?  Explore this example →
mobiscroll.settings = {
    lang: '',
    theme: ''
};

var gregorian, jalali, hijri;

gregorian = mobiscroll.eventcalendar('#demo-gregorian', {
    display: 'inline',
    calendarSystem: 'gregorian'
});

jalali = mobiscroll.eventcalendar('#demo-jalali', {
    display: 'inline',
    calendarSystem: 'jalali',
    lang: 'fa'
});

hijri = mobiscroll.eventcalendar('#demo-hijri', {
    display: 'inline',
    calendarSystem: 'hijri',
    lang: 'ar'
});

mobiscroll.util.getJson('https://trial.mobiscroll.com/events/', function (events) {
    gregorian.setEvents(events);
    jalali.setEvents(events);
    hijri.setEvents(events);
}, 'jsonp');
<div mbsc-form>
    <div class="mbsc-grid">
        <div class="mbsc-row">
            <div class="mbsc-col-sm-12 mbsc-col-md-4">
                <div class="mbsc-form-group">
                    <div class="mbsc-form-group-title">Gregorian calendar</div>
                    <div id="demo-gregorian"></div>
                </div>
            </div>
            <div class="mbsc-col-sm-12 mbsc-col-md-4">
                <div class="mbsc-form-group">
                    <div class="mbsc-form-group-title">Jalali calendar</div>
                    <div id="demo-jalali"></div>
                </div>
            </div>
            <div class="mbsc-col-sm-12 mbsc-col-md-4">
                <div class="mbsc-form-group">
                    <div class="mbsc-form-group-title">Hijri calendar</div>
                    <div id="demo-hijri"></div>
                </div>
            </div>
        </div>
    </div>
</div>

Event Calendar - Event handlers

Change demo
Event handlers

The event calendar ships with different hooks for deep customization. Events are triggered through the lifecycle of the component where you can tie in custom functionality and code. While users interact with the UI events like onEventSelect, onInit, onLabelTap ... will be triggered. Interact with the example and check the event log for the output.

For a complete list of events go to the documentation  See available lifecycle events →
Clear event log
EVENTS FIRED: 
var now = new Date(),
    instance = mobiscroll.eventcalendar('#demo', {
        lang: '',
        theme: '',
        display: 'inline',
        view: {
            calendar: { type: 'month' },
            eventList: { type: 'month' }
        },
        data: [{
            d: now,
            text: 'Green box to post office',
            color: '#6e7f29'
        }, {
            d: 'w3',
            text: 'Employment (Semi-weekly)',
            color: '#635045'
        }, {
            d: 'w5',
            text: 'Employment (Semi-weekly)',
            color: '#ff9966'
        }, {
            start: new Date(now.getFullYear(), 1, 7),
            end: new Date(now.getFullYear(), 1, 25),
            text: 'Dean OFF',
            color: '#99ff33'
        }, {
            start: new Date(now.getFullYear(), 2, 5),
            end: new Date(now.getFullYear(), 2, 14),
            text: 'Mike OFF',
            color: '#e7b300'
        }, {
            start: new Date(now.getFullYear(), 4, 7),
            end: new Date(now.getFullYear(), 4, 16),
            text: 'John OFF',
            color: '#669900'
        }, {
            start: new Date(now.getFullYear(), 5, 1),
            end: new Date(now.getFullYear(), 5, 11),
            text: 'Carol OFF',
            color: '#6699ff'
        }, {
            start: new Date(now.getFullYear(), 6, 2),
            end: new Date(now.getFullYear(), 6, 17),
            text: 'Jason OFF',
            color: '#cc9900'
        }, {
            start: new Date(now.getFullYear(), 7, 6),
            end: new Date(now.getFullYear(), 7, 14),
            text: 'Ashley OFF',
            color: '#339966'
        }, {
            start: new Date(now.getFullYear(), 8, 10),
            end: new Date(now.getFullYear(), 8, 20),
            text: 'Marisol OFF',
            color: '#8701a9'
        }, {
            start: new Date(now.getFullYear(), 9, 1),
            end: new Date(now.getFullYear(), 9, 12),
            text: 'Sharon OFF',
            color: '#cc6699'
        }, {
            d: '12/25',
            text: 'Christmas Day',
            color: '#ff0066'
        }, {
            d: '1/1',
            text: 'New Year\'s day',
            color: '#99ccff'
        }, {
            d: '4/1',
            text: 'April Fool\'s Day',
            color: '#ff6666'
        }],
        onInit: function (event, inst) {
            // Your custom event handler goes here
        },
        onMarkupReady: function (event, inst) {
            // Your custom event handler goes here
        },
        onBeforeShow: function (event, inst) {
            // Your custom event handler goes here
        },
        onPosition: function (event, inst) {
            // Your custom event handler goes here
        },
        onShow: function (event, inst) {
            // Your custom event handler goes here
        },
        onDestroy: function (event, inst) {
            // Your custom event handler goes here
        },
        onClose: function (event, inst) {
            // Your custom event handler goes here
        },
        onBeforeClose: function (event, inst) {
            // Your custom event handler goes here
        },
        onPageLoading: function (event, inst) {
            // Your custom event handler goes here
        },
        onPageLoaded: function (event, inst) {
            // Your custom event handler goes here
        },
        onPageChange: function (event, inst) {
            // Your custom event handler goes here
        },
        onEventSelect: function (event, inst) {
            // Your custom event handler goes here
        },
        onDayChange: function (event, inst) {
            // Your custom event handler goes here
        },
        onLabelTap: function (event, inst) {
            // Your custom event handler goes here
        },
        onSetDate: function (event, inst) {
            // Your custom event handler goes here
        }
    });
<div id="demo"></div>

Event Calendar - Localization

Change demo
Localization

The components are fully localized. In case of the event calendar this covers date and time format, button copy, rtl and more. You can see how each example shows up by clicking on the small flag icon or checking the examples below.

All settings can be manually overriden  See what options the localization impacts →
mobiscroll.settings = {
    lang: '',
    theme: ''
};

mobiscroll.form('#demo-localization-form', {
    inputStyle: 'box',
    labelStyle: 'inline'
});

var calInst = mobiscroll.eventcalendar('#demo-localization', {
    display: 'inline'
});

mobiscroll.select('#demo-localization-select', {
    minWidth: 200,
    display: 'bubble',
    touchUi: false,
    onSet: function (event, inst) {
        var la = inst.getVal();

        calInst.option({
            lang: la
        });

        document.getElementById('lang-flag').className = 'flag flag-' + la;
    }
});

mobiscroll.util.getJson('https://trial.mobiscroll.com/events/', function (events) {
    calInst.setEvents(events);
}, 'jsonp');
<div id="demo-localization-form" class="md-localization">
    <div class="mbsc-grid">
        <div class="mbsc-row mbsc-justify-content-center">
            <div class="mbsc-col-sm-7 mbsc-col-md-5 mbsc-col-lg-4">
                <label>
                    <span id="lang-flag" class="flag flag-en"></span>
                    <select id="demo-localization-select">
                        <option value="en">English</option>
                        <option value="ar">Arabic</option>
                        <option value="bg">Bulgarian</option>
                        <option value="ca">Català</option>
                        <option value="cs">Cestina</option>
                        <option value="zh">Chinese</option>
                        <option value="hr">Croatian</option>
                        <option value="da">Dansk</option>
                        <option value="de">Deutsch</option>
                        <option value="en-UK">English (UK)</option>
                        <option value="es">Español</option>
                        <option value="fr">Français</option>
                        <option value="el">Greek</option>
                        <option value="in">Hindi</option>
                        <option value="it">Italiano</option>
                        <option value="ja">Japanese</option>
                        <option value="ko">Korean</option>
                        <option value="lt">Lietuvių</option>
                        <option value="hu">Magyar</option>
                        <option value="nl">Nederlands</option>
                        <option value="no">Norsk</option>
                        <option value="pl">Polski</option>
                        <option value="pt-PT">Português Europeu</option>
                        <option value="pt-BR">Pt. Brasileiro</option>
                        <option value="ro">Româna</option>
                        <option value="sr">Serbian</option>
                        <option value="sk">Slovencina</option>
                        <option value="fi">Suomi</option>
                        <option value="sv">Svenska</option>
                        <option value="th">Thai</option>
                        <option value="tr">Türkçe</option>
                        <option value="ua">Ukrainian</option>
                        <option value="vi">Vietnamese</option>
                        <option value="ru">Русский</option>
                        <option value="ru-UA">Русский (UA)</option>
                        <option value="he">עברית</option>
                        <option value="fa">فارسی</option>
                    </select>
                </label>
            </div>
        </div>
        <div class="mbsc-row mbsc-justify-content-center">
            <div class="mbsc-col-sm-9 mbsc-col-md-7 mbsc-col-lg-6">
                <div id="demo-localization"></div>
            </div>
        </div>
    </div>
</div>
.md-localization span.flag {
    min-width: 22px;
    height: 15px;
    position: relative;
    left: 0;
    margin-right: 1em;
    z-index: 1;
    top: 10px;
}

.mbsc-rtl .md-localization span.flag {
    margin-right: 0;
    margin-left: 1em;
}

.mbsc-ios .md-localization span.flag {
    top: 15px;
    left: 1em;
}

.mbsc-rtl.mbsc-ios .md-localization span.flag {
    right: 1em;
}

.mbsc-windows .md-localization span.flag {
    top: 8px;
}

.md-localization img.flag {
    width: 30px;
}

.md-localization .flag {
    background: url(https://img.mobiscroll.com/demos/flags/flags_responsive.png) no-repeat;
    background-size: 100%;
}

.md-localization .flag-en {
    background-position: 0 93.38843%;
}

.md-localization .flag-ar {
    background-position: 0 76.033058%;
}

.md-localization .flag-bg {
    background-position: 0 9.090909%;
}

.md-localization .flag-ca {
    background-position: 0 14.876033%;
}

.md-localization .flag-cs {
    background-position: 0 21.900826%;
}

.md-localization .flag-zh {
    background-position: 0 19.008264%;
}

.md-localization .flag-hr {
    background-position: 0 38.429752%;
}

.md-localization .flag-da {
    background-position: 0 23.140496%;
}

.md-localization .flag-de {
    background-position: 0 22.31405%;
}

.md-localization .flag-en-UK {
    background-position: 0 92.561983%;
}

.md-localization .flag-es {
    background-position: 0 26.859504%;
}

.md-localization .flag-fr {
    background-position: 0 29.752066%;
}

.md-localization .flag-el {
    background-position: 0 34.710744%;
}

.md-localization .flag-in {
    background-position: 0 40.909091%;
}

.md-localization .flag-it {
    background-position: 0 42.975207%;
}

.md-localization .flag-ja {
    background-position: 0 44.214876%;
}

.md-localization .flag-ko {
    background-position: 0 47.520661%;
}

.md-localization .flag-lt {
    background-position: 0 52.066116%;
}

.md-localization .flag-hu {
    background-position: 0 39.256198%;
}

.md-localization .flag-nl {
    background-position: 0 65.289256%;
}

.md-localization .flag-no {
    background-position: 0 65.702479%;
}

.md-localization .flag-pl {
    background-position: 0 70.661157%;
}

.md-localization .flag-pt-PT {
    background-position: 0 72.31405%;
}

.md-localization .flag-pt-BR {
    background-position: 0 11.983471%;
}

.md-localization .flag-ro {
    background-position: 0 74.380165%;
}

.md-localization .flag-sr {
    background-position: 0 74.793388%;
}

.md-localization .flag-sk {
    background-position: 0 79.752066%;
}

.md-localization .flag-fi {
    background-position: 0 27.68595%;
}

.md-localization .flag-sv {
    background-position: 0 77.68595%;
}

.md-localization .flag-th {
    background-position: 0 85.950413%;
}

.md-localization .flag-tr {
    background-position: 0 89.256198%;
}

.md-localization .flag-ua {
    background-position: 0 91.735537%;
}

.md-localization .flag-vi {
    background-position: 0 96.694215%;
}

.md-localization .flag-ru {
    background-position: 0 75.206612%;
}

.md-localization .flag-ru-UA {
    background-position: 0 10.743802%;
}

.md-localization .flag-he {
    background-position: 0 40.495868%;
}

.md-localization .flag-fa {
    background-position: 0 42.14876%;
}

Event Calendar - Theming capabilities

Change demo
Theming capabilities

The look and feel of the event calendar can be deeply customized. There are four levels of customization:

  • Base themes: Choose between Mobiscroll, iOS, Android Material and Windows.
  • Light or dark: Every theme has a light and dark variant.
  • Custom themes: Use the theme builder to customize the colors and make it match your brand.
  • Custom CSS: If you need further customization, the sky is the limit with CSS overrides.

You can also see how every example looks by changing the theme in the floating action bar on the right side.

mobiscroll.settings = {
    lang: '',
    theme: ''
};

var ios, material, windows, mobi;

ios = mobiscroll.eventcalendar("#demo-ios", {
    theme: 'ios',
    display: 'inline',
    view: {
        calendar: {
            labels: true
        }
    }
});

material = mobiscroll.eventcalendar("#demo-material", {
    theme: 'material',
    display: 'inline',
    view: {
        calendar: {
            labels: true
        }
    }
});

windows = mobiscroll.eventcalendar("#demo-windows", {
    theme: 'windows',
    display: 'inline',
    view: {
        calendar: {
            labels: true
        }
    }
});

mobi = mobiscroll.eventcalendar("#demo-mobiscroll", {
    theme: 'mobiscroll',
    display: 'inline',
    view: {
        calendar: {
            labels: true
        }
    }
});

var radios = document.querySelectorAll('.md-demo-themes input[type="radio"]');

for (var i = 0; i < radios.length; i++) {
    radios[i].addEventListener('change', function () {
        if (this.name == "ios") {
            ios.option({ theme: this.value });
        } else if (this.name == "material") {
            material.option({ theme: this.value });
        } else if (this.name == "windows") {
            windows.option({ theme: this.value });
        } else if (this.name == "mobiscroll") {
            mobi.option({ theme: this.value });
        }
    });
}

mobiscroll.util.getJson('https://trial.mobiscroll.com/events/', function (events) {
    ios.setEvents(events);
    material.setEvents(events);
    windows.setEvents(events);
    mobi.setEvents(events);
}, 'jsonp');
<div class="mbsc-grid mbsc-grid-fixed md-demo-themes">
    <div class="mbsc-row">
        <div class="mbsc-col-sm-12 mbsc-col-md-6 mbsc-form-group">
            <div mbsc-form>
                <div class="mbsc-form-group-title">iOS Theme</div>
                <label>
                    Light
                    <input type="radio" data-role="segmented" name="ios" value="ios" checked>
                </label>
                <label>
                    Dark
                    <input type="radio" data-role="segmented" name="ios" value="ios-dark">
                </label>
                <label>
                    Custom
                    <input type="radio" data-role="segmented" name="ios" value="ios-gray">
                </label>
            </div>
            <div id="demo-ios"></div>
        </div>
        <div class="mbsc-col-sm-12 mbsc-col-md-6 mbsc-form-group">
            <div mbsc-form>
                <div class="mbsc-form-group-title">Material Theme</div>
                <label>
                    Light
                    <input type="radio" data-role="segmented" name="material" value="material" checked>
                </label>
                <label>
                    Dark
                    <input type="radio" data-role="segmented" name="material" value="material-dark">
                </label>
                <label>
                    Custom
                    <input type="radio" data-role="segmented" name="material" value="material-indigo">
                </label>
            </div>
            <div id="demo-material"></div>
        </div>
    </div>
    <div class="mbsc-row">
        <div class="mbsc-col-sm-12 mbsc-col-md-6 mbsc-form-group">
            <div mbsc-form>
                <div class="mbsc-form-group-title">Windows Theme</div>
                <label>
                    Light
                    <input type="radio" data-role="segmented" name="windows" value="windows" checked>
                </label>
                <label>
                    Dark
                    <input type="radio" data-role="segmented" name="windows" value="windows-dark">
                </label>
                <label>
                    Custom
                    <input type="radio" data-role="segmented" name="windows" value="windows-yellow">
                </label>
            </div>
            <div id="demo-windows"></div>
        </div>
        <div class="mbsc-col-sm-12 mbsc-col-md-6 mbsc-form-group">
            <div mbsc-form>
                <div class="mbsc-form-group-title">Mobiscroll Theme</div>
                <label>
                    Light
                    <input type="radio" data-role="segmented" name="mobiscroll" value="mobiscroll" checked>
                </label>
                <label>
                    Dark
                    <input type="radio" data-role="segmented" name="mobiscroll" value="mobiscroll-dark">
                </label>
                <label>
                    Custom
                    <input type="radio" data-role="segmented" name="mobiscroll" value="mobiscroll-lime">
                </label>
            </div>
            <div id="demo-mobiscroll"></div>
        </div>
    </div>
</div>

Looking for something you didn't see or have a sales question?
Ask us about it, we're here to help.

Component license


Purchase component licenses if you are looking for specific funcionality.

Total


All features will be included with the license.

Buy component license

Framework license


Get all 36 components, including with the Framework license.



Mobiscroll for Javascript $595


Use Javascript when building with plain and simple JS. Use jQuery when you have jQuery already included or if you are building with jQuery Mobile. Use AngularJS when building with Angular 1.x or Ionic 1. Use Angular when building with Angular 2/4/5/6/7 or Ionic 2/3/4. Use it when you are building your app or website with React.


Buy framework license
See other licensing options

Framework license


Get all 36 components, including with the Framework license.



Mobiscroll for Javascript $595


  • Use it when building with plain and simple JS
  • Compatible with vanilla JS app or frameworks like Vue
  • Royalty-free commercial usage
  • Technical support is included with the license
  • Use it with jQuery and jQuery Mobile
  • Enjoy the familiar API if you already use jQuery
  • Royalty-free commercial usage
  • Technical support is included with the license
  • Use it with Angular JS and Ionic 1
  • For web and mobile apps based on Angular 1.x
  • Royalty-free commercial usage
  • Technical support is included with the license
  • Use it with Angular 2/4/5/6/7 and Ionic 2/3/4
  • Visual Studio and VS Code integration
  • Royalty-free commercial usage
  • Technical support is included with the license
  • Use it when building with React JS
  • Collection of UI components for web and mobile
  • Royalty-free commercial usage
  • Technical support is included with the license
Buy framework license
See other licensing options

Framework license


Select the development framework you are using. Get all 36 components with the license.

Mobiscroll for Javascript
Mobiscroll for jQuery
Mobiscroll for React
Mobiscroll for Angular
Mobiscroll for Angular JS
  • Use it when building with plain and simple JS
  • Compatible with vanilla JS app or frameworks like Vue
  • Royalty-free commercial usage
  • Technical support is included with the license
  • Use it with jQuery and jQuery Mobile
  • Enjoy the familiar API if you already use jQuery
  • Royalty-free commercial usage
  • Technical support is included with the license
  • Use it with Angular JS and Ionic 1
  • For web and mobile apps based on Angular 1.x
  • Royalty-free commercial usage
  • Technical support is included with the license
  • Use it with Angular 2/4/5/6/7 and Ionic 2/3/4
  • Visual Studio and VS Code integration
  • Royalty-free commercial usage
  • Technical support is included with the license
  • Use it when building with React JS
  • Collection of UI components for web and mobile
  • Royalty-free commercial usage
  • Technical support is included with the license
Buy framework license
See other licensing options

Select the framework you are interested in

Javascript
jQuery
Angular
Angular JS
React

Use Javascript when building with plain and simple JS.

Use jQuery when you have jQuery already included or if you are building with jQuery Mobile.

Use AngularJS when building with Angular 1.x or Ionic 1.

Use Angular when building with Angular 2/4/5/6/7 or Ionic 2/3/4.

Use it when you are building your app or website with React.

Do you need additional support seats?

The framework license comes with one support seat. ( +$50/seat )

Add the source code?

Price
Buy now
Customize & try demos locally
Sign in or start your free trial

What framework are you using?

Javascript
jQuery
AngularJS
Angular
Ionic
React
Other
Select a framework
Email address

Customize & try this demo locally
Sign in or start your free trial

We have to set you up with a trial for this to run 👍

Email address

Customize & try demos locally
You can download and use Mobiscroll for Free

What framework are you using?

Javascript
jQuery
AngularJS
Angular
Ionic
React
Other
Select a framework
Install demo in your app
Follow this quick, two minute install guide
Close window

Step 1.Install the Mobiscroll CLI from npm

Copy command
$ npm install -g @mobiscroll/cli

The CLI makes configuring your apps super simple 👍

Step 2.Run the following command in the root folder of your Ionic project

Copy command
$ mobiscroll config ionic
$ mobiscroll config ionic --lite

You will be prompted to log in with your mobiscroll account. Set your password here

Create an Ionic 3 & Mobiscroll starter with the CLI:

$ mobiscroll start ionic myStarter

Run this command for Ionic 4 & Mobiscroll starter:

$ mobiscroll start ionic-angular myStarter

Step 3.Copy the code into your app. HTML goes into the markup, TS into Typescript.

Copy TS
Copy HTML
Copy CSS

Run ionic serve in the root folder of your app 🎉

Copy command
$ ionic serve
Thanks for downloading
Try and customize the app locally

Extract the zip file and run the project like any Ionic app. Make sure to have Ionic CLI installed and open the terminal in the app root folder.

Step 1. Run in root folder
$ npm install
Step 2. Start the app
$ ionic serve

Let us know if we can help and enjoy!

Change your password
Need to update your password? Enter and hit the button below

You are setting a password for the account

New Password Required Enter at least 6 characters
Change your password
Need to update your password? Enter and hit the button below

Your password has been changed!

Thanks for downloading
Customize demos locally

Everything is set up so that you can dig in right away and start exploring.

We have set up a trial so that you can try the demos locally.

Extract the zip file and open the demo in your favorite browser. To install Mobiscroll in your project follow instructions from this page.


Let us know if we can help and enjoy! 👍

Thanks for downloading
Customize demos locally

Please extract the zip file and run the project like any Angular CLI app. Make sure to have the Angular CLI installed.

For installation and usage, extract the zip file and open a terminal window and follow these steps.

Step 1. Run in root folder
$ npm install
Step 2. Start the app
$ ng serve --open

Let us know if we can help and enjoy! 👍

Thanks for downloading
Customize demos locally

Everything is set up so that you can dig in right away and start exploring.

We have set up a trial so that you can try the demos locally.

The easiest way to get started is to follow the installation steps and by grabbing the code directly from the demo page. Let us know if we can help and enjoy!

You'll find a fully functional Kitchen-sink Ionic app in the zip file.

Thanks for downloading
Customize demos locally

Everything is set up so that you can dig in right away and start exploring.

We have set up a trial so that you can try the demos locally.

The demos are using Babel's in-browser ES6 and JSX transformer. Extract the zip file and open the demo in your browser. To install Mobiscroll in your project follow instructions from this page.


Let us know if we can help and enjoy! 👍

Demos
Alerts & notifications
Alert Notifications Note
Components
Alerts & notifications 3
Buttons 4
Calendar 27
Cards 14
Collapsible 3
Color 10
Date & Time 20
Event Calendar 25
Forms 6
Grid layout 7
Image 7
Inputs & fields 6
Listview 17
Measurement 10
Navigation 8
Number 8
Numpad 13
Option List 4
Popup 10
Range 19
Scroller 7
Scrollview 5
Select 16
Slider & progress 4
Styling 6
Timer 5
Timespan 6
Toggle & Radio 4
Treelist 7
Theme Select
Mobiscroll
Mobiscroll Dark
Material
Material Dark
iOS
iOS Dark
Bootstrap
Windows
Windows Dark
Display Mode
Language Locale
See other demos and change options
Theme
Display
Locale
See other demos