Custom Event Sort Order
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.
Custom Event Sort Order
When rendering events, the default logic determines the order:
- All-day events are placed at the top
- Non-all-day events follow, sorted by their start times
- Events with the same start time are ordered alphabetically by their title
The order property of the event data can be used to override the default ordering. The order property takes precedence over the default rules. If two events have the same order value, the default rules apply. For a more advanced order logic, the eventOrder option can be used which expects a function that compares two events and returns an order (-1 or 1).
Demo

Code
View code on GitHub
import { Eventcalendar, setOptions } from '@mobiscroll/react';
import { useMemo } from 'react';
setOptions({
locale: ,
theme: ' ',
themeVariant: ' '
});
const now = new Date();
const day = now.getDay();
const monday = now.getDate() - day + (day == 0 ? -6 : 1);
function App() {
const myEvents = useMemo(
() => [
{
start: new Date(now.getFullYear(), now.getMonth(), monday),
title: 'Kate OFF (PROPOSED)',
color: '#e7b300',
allDay: true,
accepted: false,
order: 1,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday),
title: 'John OFF (APPROVED)',
color: '#00ca10',
allDay: true,
accepted: true,
order: 2,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday),
title: 'Mark OFF (PROPOSED)',
color: '#e7b300',
allDay: true,
accepted: false,
order: 1,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday),
title: 'Emma OFF (PROPOSED)',
color: '#e7b300',
allDay: true,
accepted: false,
order: 1,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 1),
title: 'Mark OFF (APPROVED)',
color: '#00ca10',
allDay: true,
accepted: true,
order: 2,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 1),
title: 'Carol OFF (PROPOSED)',
color: '#e7b300',
allDay: true,
accepted: false,
order: 1,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 2),
title: 'Luke OFF (PROPOSED)',
color: '#e7b300',
allDay: true,
accepted: false,
order: 1,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 2),
title: 'Carol OFF (APPROVED)',
color: '#00ca10',
allDay: true,
accepted: true,
order: 2,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 2),
title: 'Kate OFF (APPROVED)',
color: '#00ca10',
allDay: true,
accepted: true,
order: 2,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 2),
title: 'Dean OFF (PROPOSED)',
color: '#e7b300',
allDay: true,
accepted: false,
order: 1,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 2),
title: 'Emma OFF (APPROVED)',
color: '#00ca10',
allDay: true,
accepted: true,
order: 2,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 2),
title: 'Jason OFF (APPROVED)',
color: '#00ca10',
allDay: true,
accepted: true,
order: 2,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 3),
title: 'Jason OFF (APPROVED)',
color: '#00ca10',
allDay: true,
accepted: true,
order: 2,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 4),
title: 'Ryan OFF (PROPOSED)',
color: '#e7b300',
allDay: true,
accepted: false,
order: 1,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 4),
title: 'John OFF (APPROVED)',
color: '#00ca10',
allDay: true,
accepted: true,
order: 2,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 4),
title: 'Dean OFF (PROPOSED)',
color: '#e7b300',
allDay: true,
accepted: false,
order: 1,
},
],
[],
);
const myView = useMemo(() => ({ calendar: { type: 'week' } }), []);
return (
<Eventcalendar
clickToCreate={ }
dragToCreate={ }
dragToMove={ }
dragToResize={ }
eventDelete={ }
view={myView}
data={myEvents}
/>
);
}
export default App;
import { Eventcalendar, MbscCalendarEvent, MbscEventcalendarView, setOptions } from '@mobiscroll/react';
import { useMemo } from 'react';
setOptions({
locale: ,
theme: ' ',
themeVariant: ' '
});
const now = new Date();
const day = now.getDay();
const monday = now.getDate() - day + (day == 0 ? -6 : 1);
const myEvents: MbscCalendarEvent[] = [
{
start: new Date(now.getFullYear(), now.getMonth(), monday),
title: 'Kate OFF (PROPOSED)',
color: '#e7b300',
allDay: true,
accepted: false,
order: 1,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday),
title: 'John OFF (APPROVED)',
color: '#00ca10',
allDay: true,
accepted: true,
order: 2,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday),
title: 'Mark OFF (PROPOSED)',
color: '#e7b300',
allDay: true,
accepted: false,
order: 1,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday),
title: 'Emma OFF (PROPOSED)',
color: '#e7b300',
allDay: true,
accepted: false,
order: 1,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 1),
title: 'Mark OFF (APPROVED)',
color: '#00ca10',
allDay: true,
accepted: true,
order: 2,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 1),
title: 'Carol OFF (PROPOSED)',
color: '#e7b300',
allDay: true,
accepted: false,
order: 1,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 2),
title: 'Luke OFF (PROPOSED)',
color: '#e7b300',
allDay: true,
accepted: false,
order: 1,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 2),
title: 'Carol OFF (APPROVED)',
color: '#00ca10',
allDay: true,
accepted: true,
order: 2,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 2),
title: 'Kate OFF (APPROVED)',
color: '#00ca10',
allDay: true,
accepted: true,
order: 2,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 2),
title: 'Dean OFF (PROPOSED)',
color: '#e7b300',
allDay: true,
accepted: false,
order: 1,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 2),
title: 'Emma OFF (APPROVED)',
color: '#00ca10',
allDay: true,
accepted: true,
order: 2,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 2),
title: 'Jason OFF (APPROVED)',
color: '#00ca10',
allDay: true,
accepted: true,
order: 2,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 3),
title: 'Jason OFF (APPROVED)',
color: '#00ca10',
allDay: true,
accepted: true,
order: 2,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 4),
title: 'Ryan OFF (PROPOSED)',
color: '#e7b300',
allDay: true,
accepted: false,
order: 1,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 4),
title: 'John OFF (APPROVED)',
color: '#00ca10',
allDay: true,
accepted: true,
order: 2,
},
{
start: new Date(now.getFullYear(), now.getMonth(), monday + 4),
title: 'Dean OFF (PROPOSED)',
color: '#e7b300',
allDay: true,
accepted: false,
order: 1,
},
];
function App() {
const myView = useMemo<MbscEventcalendarView>(
() => ({
calendar: {
type: 'week',
},
}),
[],
);
return (
<Eventcalendar
clickToCreate={ }
dragToCreate={ }
dragToMove={ }
dragToResize={ }
eventDelete={ }
view={myView}
data={myEvents}
/>
);
}
export default App;