Switch Day, Week and Month Views
Usage
theme: 'ios' You can turn auto theming on and let it decide based on the platform.
Usage
themeVariant: 'light' You can turn auto dark mode on based on system settings.
Usage
clickToCreate: true,
// click to create is on dragToCreate: true,
// drag to create is on dragToMove: true,
// reordering is on dragToResize: true,
// resizing is on eventDelete: true
// deleting is on Fine-tune drag & drop with these options, which are false by default.
Usage
locale: localeEn Selecting the locale loads the localized settings and the translated UI text.
Switch Day, Week and Month Views
Dynamically switch views within one calendar instance. Use a UI control to let users do the switching or do it programmatically. This example features a segmented component inside the header, but the live option changes can be invoked from anywhere.
Switch between a month view with a monthly agenda, a week view with a weekly agenda and daily event list.
Thanks to property binding and all option changes are live and propagate accordingly.
Demo

Code
View code on GitHub
<script setup>
import {
getJson,
MbscCalendarNav,
MbscCalendarNext,
MbscCalendarPrev,
MbscEventcalendar,
MbscSegmented,
MbscSegmentedGroup,
setOptions
} from '@mobiscroll/vue'
import { onMounted, ref } from 'vue'
setOptions({
locale: ,
theme: ' ',
themeVariant: ' '
})
const myEvents = ref([])
const myView = ref({
calendar: { type: 'month' },
agenda: { type: 'month' }
})
const view = ref('month')
function changeView() {
setTimeout(() => {
switch (view.value) {
case 'month':
myView.value = {
calendar: { type: 'month' },
agenda: { type: 'month' }
}
break
case 'week':
myView.value = {
calendar: { type: 'week' },
agenda: { type: 'week' }
}
break
case 'day':
myView.value = {
agenda: { type: 'day' }
}
break
}
})
}
onMounted(() => {
getJson(
'https://trial.mobiscroll.com/events/?vers=5',
(events) => {
myEvents.value = events
},
'jsonp'
)
})
</script>
<template>
<MbscEventcalendar :clickToCreate="" :dragToCreate="" :dragToMove="" :dragToResize="" :eventDelete="" :view="myView" :data="myEvents">
<template #header>
<MbscCalendarNav />
<div class="mbsc-flex mbsc-flex-1-0 mbsc-justify-content-center">
<MbscSegmentedGroup v-model="view" @change="changeView()">
<MbscSegmented value="month" icon="material-event-note"></MbscSegmented>
<MbscSegmented value="week" icon="material-date-range"></MbscSegmented>
<MbscSegmented value="day" icon="material-view-day"></MbscSegmented>
</MbscSegmentedGroup>
</div>
<MbscCalendarPrev cssClass="cal-header-prev" />
<MbscCalendarNext cssClass="cal-header-next" />
</template>
</MbscEventcalendar>
</template>
<style>
.md-switching-view-cont {
height: 100%;
}
.md-switching-view-cont .mbsc-segmented {
margin: 0;
}
.md-switching-view-cont .mbsc-segmented.mbsc-material,
.md-switching-view-cont .mbsc-segmented.mbsc-windows {
padding: 0;
}
.md-switching-view-cont .mbsc-segmented .mbsc-segmented-button {
padding: 0 1px;
}
.md-switching-view-cont .mbsc-segmented .mbsc-icon {
font-size: 20px;
}
.md-switching-view-cont .mbsc-segmented-button.mbsc-windows {
border: 0;
}
.cal-header-picker {
-webkit-flex: 1 0 auto;
-moz-box-flex: 1;
-ms-flex: 1 0 auto;
flex: 1 0 auto;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
-webkit-justify-content: center;
-moz-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
.cal-header-nav {
width: 165px;
}
.cal-header-nav .mbsc-calendar-title.mbsc-material {
font-size: 16px;
}
</style> <script setup lang="ts">
import {
getJson,
MbscCalendarNav,
MbscCalendarNext,
MbscCalendarPrev,
MbscEventcalendar,
MbscSegmented,
MbscSegmentedGroup,
setOptions
} from '@mobiscroll/vue'
import type { MbscCalendarEvent, MbscEventcalendarView } from '@mobiscroll/vue'
import { onMounted, ref } from 'vue'
setOptions({
locale: ,
theme: ' ',
themeVariant: ' '
})
const myEvents = ref<MbscCalendarEvent[]>([])
const myView = ref<MbscEventcalendarView>({
calendar: { type: 'month' },
agenda: { type: 'month' }
})
const view = ref<string>('month')
function changeView() {
setTimeout(() => {
switch (view.value) {
case 'month':
myView.value = {
calendar: { type: 'month' },
agenda: { type: 'month' }
}
break
case 'week':
myView.value = {
calendar: { type: 'week' },
agenda: { type: 'week' }
}
break
case 'day':
myView.value = {
agenda: { type: 'day' }
}
break
}
})
}
onMounted(() => {
getJson(
'https://trial.mobiscroll.com/events/?vers=5',
(events: MbscCalendarEvent[]) => {
myEvents.value = events
},
'jsonp'
)
})
</script>
<template>
<MbscEventcalendar :clickToCreate="" :dragToCreate="" :dragToMove="" :dragToResize="" :eventDelete="" :view="myView" :data="myEvents">
<template #header>
<MbscCalendarNav />
<div class="mbsc-flex mbsc-flex-1-0 mbsc-justify-content-center">
<MbscSegmentedGroup v-model="view" @change="changeView()">
<MbscSegmented value="month" icon="material-event-note"></MbscSegmented>
<MbscSegmented value="week" icon="material-date-range"></MbscSegmented>
<MbscSegmented value="day" icon="material-view-day"></MbscSegmented>
</MbscSegmentedGroup>
</div>
<MbscCalendarPrev cssClass="cal-header-prev" />
<MbscCalendarNext cssClass="cal-header-next" />
</template>
</MbscEventcalendar>
</template>
<style>
.md-switching-view-cont {
height: 100%;
}
.md-switching-view-cont .mbsc-segmented {
margin: 0;
}
.md-switching-view-cont .mbsc-segmented.mbsc-material,
.md-switching-view-cont .mbsc-segmented.mbsc-windows {
padding: 0;
}
.md-switching-view-cont .mbsc-segmented .mbsc-segmented-button {
padding: 0 1px;
}
.md-switching-view-cont .mbsc-segmented .mbsc-icon {
font-size: 20px;
}
.md-switching-view-cont .mbsc-segmented-button.mbsc-windows {
border: 0;
}
.cal-header-picker {
-webkit-flex: 1 0 auto;
-moz-box-flex: 1;
-ms-flex: 1 0 auto;
flex: 1 0 auto;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
-webkit-justify-content: center;
-moz-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
.cal-header-nav {
width: 165px;
}
.cal-header-nav .mbsc-calendar-title.mbsc-material {
font-size: 16px;
}
</style>