Event creation modal
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
touchUi={true}
// touch interaction is enabled Use touch interaction on mobile or pointer interaction on desktop.
Usage
locale={localeEn} Selecting the locale loads the localized settings and the translated UI text.
Event creation modal
Use the popup to show a modal with an add/edit form for event creation and/or update. The popup can be easily set up to be shown right in the middle of the screen, top, bottom or anchored to the newly added event. Check out the different display modes and play around with the different configurations.
You have full control over what is shown within the popup. Use Mobiscroll form elements or any components that you are already using throughout your application.
Demo
Code
View code on GitHub
import {
Button,
Datepicker,
Eventcalendar,
Input,
Page,
Popup,
Segmented,
SegmentedGroup,
setOptions,
Switch,
Toast ,
} from '@mobiscroll/react';
import { useCallback, useMemo, useState } from 'react';
setOptions({
locale: ,
theme: ' ',
themeVariant: ' '
});
function App() {
const [isPopupOpen, setPopupOpen] = useState(false);
const [popupEventAllDay, setAllDay] = useState(false);
const [popupEventTitle, setTitle] = useState('');
const [popupEventDescription, setDescription] = useState('');
const [popupEventStatus, setStatus] = useState(false);
const [popupEventDate, setDate] = useState([]);
const [start, startRef] = useState(null);
const [end, endRef] = useState(null);
const [mySelectedDate, setSelectedDate] = useState([]);
const [isToastOpen, setToastOpen] = useState(false);
const [toastMessage, setToastMessage] = useState();
const controls = useMemo(() => (popupEventAllDay ? ['calendar'] : ['calendar', 'time']), [popupEventAllDay]);
const [myEvents, setMyEvents] = useState([
{
id: 1,
start: '2026-10-08T13:00',
end: '2026-10-08T13:45',
title: "Lunch @ Butcher's",
description: '',
allDay: false,
bufferBefore: 15,
free: true,
color: '#009788',
},
{
id: 2,
start: '2026-10-26T15:00',
end: '2026-10-26T16:00',
title: 'Conference',
description: '',
allDay: false,
bufferBefore: 30,
free: false,
color: '#ff9900',
},
{
id: 3,
start: '2026-10-25T18:00',
end: '2026-10-25T22:00',
title: 'Site Visit',
description: '',
allDay: false,
bufferBefore: 60,
free: true,
color: '#3f51b5',
},
{
id: 4,
start: '2026-10-27T10:30',
end: '2026-10-27T11:30',
title: 'Stakeholder mtg.',
description: '',
allDay: false,
free: false,
color: '#f44437',
},
]);
const openPopup = useCallback(() => {
setDate([new Date(), new Date()]);
setTitle('New Event');
setDescription('');
setAllDay(false);
setStatus(false);
setPopupOpen(true);
}, []);
const handleClose = useCallback(() => {
setPopupOpen(false);
}, []);
const dateChange = useCallback((args) => {
setDate(args.value);
}, []);
const allDayChange = useCallback((ev) => {
setAllDay(ev.target.checked);
}, []);
const titleChange = useCallback((ev) => {
setTitle(ev.target.value);
}, []);
const descriptionChange = useCallback((ev) => {
setDescription(ev.target.value);
}, []);
const handleCloseToast = useCallback(() => {
setToastOpen(false);
}, []);
return (
<Page class="mds-full-height">
<div className="mds-full-height mbsc-flex-col">
<div className="mbsc-button-group-block">
<Button onClick={openPopup}>Add new event</Button>
</div>
<Popup
width={400}
contentPadding={false}
headerText="Add new event"
display="center"
showOverlay={false}
isOpen={isPopupOpen}
buttons={[
'cancel',
{
text: 'Add',
keyCode: 'enter',
handler: function () {
const newEvent = {
title: popupEventTitle,
description: popupEventDescription,
allDay: popupEventAllDay,
status: popupEventStatus,
start: popupEventDate[0],
end: popupEventDate[1],
};
setMyEvents([...myEvents, newEvent]);
setSelectedDate(newEvent.start);
handleClose();
setToastMessage('Event added');
setToastOpen(true);
},
cssClass: 'mbsc-popup-button-primary',
},
]}
onClose={() => {
handleClose();
}}
>
<div id="demo-add-event-popup">
<div className="mbsc-form-group">
<Input label="Title" value={popupEventTitle} onChange={titleChange} />
<Input label="Description" value={popupEventDescription} onChange={descriptionChange} />
</div>
<div className="mbsc-form-group">
<Switch label="All-day" checked={popupEventAllDay} onChange={allDayChange} />
<Input ref={startRef} label="Starts" />
<Input ref={endRef} label="Ends" />
<Datepicker
select="range"
display="anchored"
controls={controls}
touchUi={true}
startInput={start}
endInput={end}
showRangeLabels={false}
onChange={dateChange}
value={popupEventDate}
/>
</div>
<div className="mbsc-form-group">
<SegmentedGroup>
<Segmented value="busy" checked={true}>
Show as busy
</Segmented>
<Segmented value="free">Show as free</Segmented>
</SegmentedGroup>
</div>
</div>
</Popup>
<Eventcalendar class="mbsc-flex-1-1" data={myEvents} selectedDate={mySelectedDate}></Eventcalendar>
<Toast message={toastMessage} isOpen={isToastOpen} onClose={handleCloseToast} />
</div>
</Page>
);
}
export default App;
import {
Button,
Datepicker,
Eventcalendar,
Input,
MbscCalendarEvent,
MbscDatepickerChangeEvent,
MbscDatepickerControl,
MbscDateType,
Page,
Popup,
Segmented,
SegmentedGroup,
setOptions,
Switch,
Toast ,
} from '@mobiscroll/react';
import { ChangeEvent, useCallback, useMemo, useState } from 'react';
setOptions({
locale: ,
theme: ' ',
themeVariant: ' '
});
function App() {
const [isPopupOpen, setPopupOpen] = useState<boolean>(false);
const [popupEventAllDay, setAllDay] = useState<boolean>(false);
const [popupEventTitle, setTitle] = useState<string>('');
const [popupEventDescription, setDescription] = useState<string>('');
const [popupEventStatus, setStatus] = useState<boolean>(false);
const [popupEventDate, setDate] = useState<MbscDateType[]>([]);
const [start, startRef] = useState<Input | null>(null);
const [end, endRef] = useState<Input | null>(null);
const [mySelectedDate, setSelectedDate] = useState<MbscDateType>();
const [isToastOpen, setToastOpen] = useState(false);
const [toastMessage, setToastMessage] = useState<string>();
const controls = useMemo(() => (popupEventAllDay ? ['calendar'] : ['calendar', 'time']) as MbscDatepickerControl[], [popupEventAllDay]);
const [myEvents, setMyEvents] = useState<MbscCalendarEvent[]>([
{
id: 1,
start: '2026-10-08T13:00',
end: '2026-10-08T13:45',
title: "Lunch @ Butcher's",
description: '',
allDay: false,
bufferBefore: 15,
free: true,
color: '#009788',
},
{
id: 2,
start: '2026-10-26T15:00',
end: '2026-10-26T16:00',
title: 'Conference',
description: '',
allDay: false,
bufferBefore: 30,
free: false,
color: '#ff9900',
},
{
id: 3,
start: '2026-10-25T18:00',
end: '2026-10-25T22:00',
title: 'Site Visit',
description: '',
allDay: false,
bufferBefore: 60,
free: true,
color: '#3f51b5',
},
{
id: 4,
start: '2026-10-27T10:30',
end: '2026-10-27T11:30',
title: 'Stakeholder mtg.',
description: '',
allDay: false,
free: false,
color: '#f44437',
},
]);
const openPopup = useCallback(() => {
setDate([new Date(), new Date()]);
setTitle('New Event');
setDescription('');
setAllDay(false);
setStatus(false);
setPopupOpen(true);
}, []);
const handleClose = useCallback(() => {
setPopupOpen(false);
}, []);
const dateChange = useCallback((args: MbscDatepickerChangeEvent) => {
setDate(args.value as Array<MbscDateType>);
}, []);
const allDayChange = useCallback((ev: ChangeEvent<HTMLInputElement>) => {
setAllDay(ev.target.checked);
}, []);
const titleChange = useCallback((ev: ChangeEvent<HTMLInputElement>) => {
setTitle(ev.target.value);
}, []);
const descriptionChange = useCallback((ev: ChangeEvent<HTMLInputElement>) => {
setDescription(ev.target.value);
}, []);
const handleCloseToast = useCallback(() => {
setToastOpen(false);
}, []);
return (
<Page class="mds-full-height">
<div className="mds-full-height mbsc-flex-col">
<div className="mbsc-button-group-block">
<Button onClick={openPopup}>Add new event</Button>
</div>
<Popup
width={400}
contentPadding={false}
headerText="Add new event"
display="center"
showOverlay={false}
isOpen={isPopupOpen}
buttons={[
'cancel',
{
text: 'Add',
keyCode: 'enter',
handler: function () {
const newEvent = {
title: popupEventTitle,
description: popupEventDescription,
allDay: popupEventAllDay,
status: popupEventStatus,
start: popupEventDate[0],
end: popupEventDate[1],
};
setMyEvents([...myEvents, newEvent]);
setSelectedDate(newEvent.start);
handleClose();
setToastMessage('Event added');
setToastOpen(true);
},
cssClass: 'mbsc-popup-button-primary',
},
]}
onClose={() => {
handleClose();
}}
>
<div id="demo-add-event-popup">
<div className="mbsc-form-group">
<Input label="Title" value={popupEventTitle} onChange={titleChange} />
<Input label="Description" value={popupEventDescription} onChange={descriptionChange} />
</div>
<div className="mbsc-form-group">
<Switch label="All-day" checked={popupEventAllDay} onChange={allDayChange} />
<Input ref={startRef} label="Starts" />
<Input ref={endRef} label="Ends" />
<Datepicker
select="range"
display="anchored"
controls={controls}
touchUi={true}
startInput={start}
endInput={end}
showRangeLabels={false}
onChange={dateChange}
value={popupEventDate}
/>
</div>
<div className="mbsc-form-group">
<SegmentedGroup>
<Segmented value="busy" checked={true}>
Show as busy
</Segmented>
<Segmented value="free">Show as free</Segmented>
</SegmentedGroup>
</div>
</div>
</Popup>
<Eventcalendar class="mbsc-flex-1-1" data={myEvents} selectedDate={mySelectedDate}></Eventcalendar>
<Toast message={toastMessage} isOpen={isToastOpen} onClose={handleCloseToast} />
</div>
</Page>
);
}
export default App;