Event Search Popup
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.
Event Search Popup
Use the available real estate in the calendar header to add event search. With the templating capabilities of the header you can easily add a search box and use a separate agenda instance to show the search results. This example is relying on a single API endpoint for getting the data onto the primary calendar view and also for getting the filtered data based on the search terms.
Events can be filtered in real time so using an agenda view for the search results is an easy choice. It provides all the necessary styling and advanced features that you might need to customize the experience.
Alternatively, search can be implemented in a sidebar next to the event calendar using a similar search box with an inline agenda instead of a dropdown.
Demo

Code
View code on GitHub
<script setup>
import {
formatDate,
getJson,
MbscCalendarNav,
MbscCalendarNext,
MbscCalendarPrev,
MbscCalendarToday,
MbscEventcalendar,
MbscInput,
MbscPopup,
setOptions
} from '@mobiscroll/vue'
import { ref } from 'vue'
setOptions({
locale: ,
theme: ' ',
themeVariant: ' '
})
const calEvents = ref([])
const isPopupOpen = ref(false)
const listEvents = ref([])
const searchInput = ref(null)
const selectedEvent = ref([])
const calInst = ref(null)
const timer = ref(null)
const inputRef = ref(null)
const calView = { calendar: { labels: true } }
const listView = { agenda: { type: 'year', size: 5 } }
function handleInputChange(ev) {
const searchText = ev.target.value
clearTimeout(timer.value)
timer.value = setTimeout(() => {
if (searchText.length > 0) {
getJson(
'https://trial.mobiscroll.com/searchevents/?text=' + searchText,
(data) => {
listEvents.value = data
isPopupOpen.value = true
},
'jsonp'
)
} else {
isPopupOpen.value = false
}
}, 200)
}
function handleInputFocus(ev) {
if (ev.target.value.length > 0) {
isPopupOpen.value = true
}
}
function handlePageLoading(args) {
const start = formatDate('YYYY-MM-DD', args.viewStart)
const end = formatDate('YYYY-MM-DD', args.viewEnd)
setTimeout(() => {
getJson(
'https://trial.mobiscroll.com/searchevents/?start=' + start + '&end=' + end,
(data) => {
calEvents.value = data
},
'jsonp'
)
})
}
function handlePopupClose() {
isPopupOpen.value = false
}
function handleEventClick(args) {
selectedEvent.value = [args.event]
isPopupOpen.value = false
calInst.value.instance.navigateToEvent(args.event)
}
function handleInit() {
setTimeout(() => {
searchInput.value = inputRef.value.instance.nativeElement
})
}
</script>
<template>
<MbscEventcalendar
ref="calInst"
:clickToCreate="false"
:data="calEvents"
:dragToCreate="false"
:dragToMove="false"
:dragToResize="false"
:selectMultipleEvents="true"
:selectedEvents="selectedEvent"
:view="calView"
@init="handleInit"
@page-loading="handlePageLoading"
>
<template #header>
<MbscCalendarNav />
<div class="mds-search-bar mbsc-flex-1-0">
<MbscInput
autocomplete="off"
inputStyle="box"
placeholder="Search events"
startIcon="material-search"
ref="inputRef"
@input="handleInputChange"
@focus="handleInputFocus"
/>
</div>
<MbscCalendarPrev />
<MbscCalendarToday />
<MbscCalendarNext />
</template>
</MbscEventcalendar>
<MbscPopup
display="anchored"
:anchor="searchInput"
:contentPadding="false"
:focusElm="searchInput"
:focusOnClose="false"
:focusOnOpen="false"
:isOpen="isPopupOpen"
:scrollLock="false"
:showArrow="false"
:showOverlay="false"
:width="200"
@close="handlePopupClose"
>
<MbscEventcalendar
cssClass="mds-search-results"
:data="listEvents"
:showControls="false"
:view="listView"
@event-click="handleEventClick"
/>
</MbscPopup>
</template>
<style>
.mds-search-bar .mbsc-textfield-wrapper {
max-width: 400px;
margin: 8px auto;
}
.mds-search-bar .mbsc-textfield.mbsc-ios-dark {
background: #313131;
}
.mds-search-results .mbsc-calendar-wrapper {
margin-top: -1px;
}
</style> <script setup lang="ts">
import {
formatDate,
getJson,
MbscCalendarNav,
MbscCalendarNext,
MbscCalendarPrev,
MbscCalendarToday,
MbscEventcalendar,
MbscInput,
MbscPopup,
setOptions
} from '@mobiscroll/vue'
import type {
MbscCalendarEvent,
MbscEventcalendarView,
MbscEventClickEvent,
MbscPageLoadingEvent
} from '@mobiscroll/vue'
import { ref } from 'vue'
setOptions({
locale: ,
theme: ' ',
themeVariant: ' '
})
const calEvents = ref<MbscCalendarEvent[]>([])
const isPopupOpen = ref<boolean>(false)
const listEvents = ref<MbscCalendarEvent[]>([])
const searchInput = ref<HTMLInputElement>()
const selectedEvent = ref<MbscCalendarEvent[]>([])
const calInst = ref<typeof MbscEventcalendar>()
const timer = ref<ReturnType<typeof setTimeout>>()
const inputRef = ref<typeof MbscInput>()
const calView: MbscEventcalendarView = { calendar: { labels: true } }
const listView: MbscEventcalendarView = { agenda: { type: 'year', size: 5 } }
function handleInputChange(ev: Event) {
const input = ev.target as HTMLInputElement
const text = input.value
clearTimeout(timer.value)
timer.value = setTimeout(() => {
if (text.length > 0) {
getJson(
'https://trial.mobiscroll.com/searchevents/?text=' + text,
(data: MbscCalendarEvent[]) => {
listEvents.value = data
isPopupOpen.value = true
},
'jsonp'
)
} else {
isPopupOpen.value = false
}
}, 200)
}
function handleInputFocus(ev: Event) {
const input = ev.target as HTMLInputElement
if (input.value.length > 0) {
isPopupOpen.value = true
}
}
function handlePageLoading(args: MbscPageLoadingEvent) {
const start = formatDate('YYYY-MM-DD', args.viewStart!)
const end = formatDate('YYYY-MM-DD', args.viewEnd!)
setTimeout(() => {
getJson(
'https://trial.mobiscroll.com/searchevents/?start=' + start + '&end=' + end,
(data: MbscCalendarEvent[]) => {
calEvents.value = data
},
'jsonp'
)
})
}
function handlePopupClose() {
isPopupOpen.value = false
}
function handleEventClick(args: MbscEventClickEvent) {
selectedEvent.value = [args.event]
isPopupOpen.value = false
calInst.value?.instance.navigateToEvent(args.event)
}
function handleInit() {
setTimeout(() => {
searchInput.value = inputRef.value?.instance.nativeElement
})
}
</script>
<template>
<MbscEventcalendar
ref="calInst"
:clickToCreate="false"
:data="calEvents"
:dragToCreate="false"
:dragToMove="false"
:dragToResize="false"
:selectMultipleEvents="true"
:selectedEvents="selectedEvent"
:view="calView"
@init="handleInit"
@page-loading="handlePageLoading"
>
<template #header>
<MbscCalendarNav />
<div class="mds-search-bar mbsc-flex-1-0">
<MbscInput
autocomplete="off"
inputStyle="box"
placeholder="Search events"
startIcon="material-search"
ref="inputRef"
@input="handleInputChange"
@focus="handleInputFocus"
/>
</div>
<MbscCalendarPrev />
<MbscCalendarToday />
<MbscCalendarNext />
</template>
</MbscEventcalendar>
<MbscPopup
display="anchored"
:anchor="searchInput"
:contentPadding="false"
:focusElm="searchInput"
:focusOnClose="false"
:focusOnOpen="false"
:isOpen="isPopupOpen"
:scrollLock="false"
:showArrow="false"
:showOverlay="false"
:width="200"
@close="handlePopupClose"
>
<MbscEventcalendar
cssClass="mds-search-results"
:data="listEvents"
:showControls="false"
:view="listView"
@event-click="handleEventClick"
/>
</MbscPopup>
</template>
<style>
.mds-search-bar .mbsc-textfield-wrapper {
max-width: 400px;
margin: 8px auto;
}
.mds-search-bar .mbsc-textfield.mbsc-ios-dark {
background: #313131;
}
.mds-search-results .mbsc-calendar-wrapper {
margin-top: -1px;
}
</style>