Scheduler
RC.12.1
Included in RC.12.1 for Vue + Vite, Nuxt and NativeScript.
<MScheduler
v-model="events"
v-model:date="date"
timeZone="America/Sao_Paulo"
label="Studio"
:days="7"
/>| Prop | Type | Default | Contract |
|---|---|---|---|
modelValue / date / timeZone | SchedulerEvent[] / CivilDate / string | required | Stable id/title and start/end epoch milliseconds; explicit IANA zone. Up to 500 events, maximum duration 31 days. |
days / startHour / endHour | 1|7 / number / number | 7 / 8 / 19 | Day/week view and ordered whole-hour bounds 0–24. |
slotMinutes / hourHeight / dayWidth | number | 15 / 80 / 180 | A 5–60 minute divisor of one hour; height 48–180 and width 140–500px/DIP. |
now | number | null | null | The current instant in epoch milliseconds. Marks a line on its day; the app updates it as time passes. |
disambiguation | reject | earlier | later | reject | Repeated local times require explicit choice; nonexistent times are rejected. |
animated / disabled | boolean | true / false | Jolt layout and editing lock. Events may be disabled individually. |
label / id | string | required / optional | Accessible component name and optional stable ID. |
Overlapping events occupy separate lanes; multi-day events are clipped into daily segments. A text list exposes every event, including short/clipped entries, with zone offsets to distinguish repeated times. Select an event to move it by a slot/day or resize using explicit buttons. Large single-day segments expose move/resize gesture handles; short segments use the same explicit controls. Dragging is bounded to the visible day/hour range and snaps to slotMinutes. External model/date/zone changes cancel drafts. Moving preserves elapsed duration; resizing resolves the new wall time in the chosen zone. Intl is used on Web; native formatters on iOS/Android. Reduced motion disables decorative settling. No recurrence, resources, remote persistence, calendar sync or automatic conflict resolution is included.
update:modelValue → SchedulerEvent[]; update:date → CivilDate; change → {id,start,end,kind}; select → event ID; error → message.
Paging to another range brings its days and events in from the side they came from. A held event lifts slightly, a changed or selected event gives a small bump, and a refused change shakes the event and its message. With now, a line marks the current time on its day and its dot sends out a ripple each minute; the line is decoration and lets pointers through.
Motion uses Jolt and respects reduced motion. Use :animated="false" for static presentation.
<script setup lang="ts">
import { computed, ref, onBeforeUnmount } from 'vue'
import { useCatalogLocale } from '../locale'
const props = defineProps<{ lang?: 'en' | 'pt' }>()
const { locale } = useCatalogLocale(() => props.lang)
const t = (en: string, pt: string) => ((props.lang ?? locale.value) === 'pt' ? pt : en)
const animated = ref(true)
import { civilDate, type SchedulerEvent } from '@getcortexlabs/mavis-core'
const date = ref(civilDate('2026-11-02')),
single = ref(true),
last = ref(''),
now = ref(Date.parse('2026-11-02T16:20:00Z'))
const tick = setInterval(() => (now.value += 60000), 10000)
onBeforeUnmount(() => clearInterval(tick))
const events = ref<SchedulerEvent[]>([
{
id: 'walk',
title: 'Morning field walk',
start: Date.parse('2026-11-02T14:00:00Z'),
end: Date.parse('2026-11-02T16:00:00Z'),
},
{
id: 'review',
title: 'Portfolio review',
start: Date.parse('2026-11-02T15:00:00Z'),
end: Date.parse('2026-11-02T16:30:00Z'),
},
{
id: 'note',
title: 'A small pause',
start: Date.parse('2026-11-02T18:00:00Z'),
end: Date.parse('2026-11-02T18:15:00Z'),
},
{
id: 'print',
title: 'Print workshop',
start: Date.parse('2026-11-03T15:00:00Z'),
end: Date.parse('2026-11-03T17:00:00Z'),
},
])
</script>
<template>
<MColumn gap="lg">
<MText text="THE FIELD GUIDE / 05" variant="overline" tone="primary" />
<MText
:text="t('Make time for the good work.', 'Reserve tempo para o que importa.')"
variant="title"
/>
<MSwitch v-model="single" :label="t('One day at a time', 'Um dia de cada vez')" />
<MScheduler
id="studio-scheduler"
v-model="events"
:date="date"
@update:date="date = civilDate($event)"
timeZone="America/New_York"
:days="single ? 1 : 7"
:startHour="8"
:endHour="16"
:dayWidth="280"
:now="now"
:animated="animated"
:label="t('A week at the studio', 'Uma semana no estúdio')"
:previousLabel="t('Previous', 'Anterior')"
:nextLabel="t('Next', 'Próximo')"
:moveLabel="t('Move event', 'Mover evento')"
:resizeLabel="t('Resize event', 'Redimensionar evento')"
:earlierLabel="t('Earlier', 'Mais cedo')"
:laterLabel="t('Later', 'Mais tarde')"
:previousDayLabel="t('Previous day', 'Dia anterior')"
:nextDayLabel="t('Next day', 'Próximo dia')"
:shorterLabel="t('Shorter', 'Mais curto')"
:longerLabel="t('Longer', 'Mais longo')"
:emptyLabel="t('A day with room to breathe', 'Um dia com espaço para respirar')"
@change="last = $event.id + ':' + new Date($event.start).toISOString()"
/>
<MText id="scheduler-result" :text="last" variant="caption" tone="muted" />
</MColumn>
<MColumn gap="lg">
<MSwitch v-model="animated" :label="t('Animate changes', 'Animar mudanças')" />
</MColumn>
</template>Desktop
The day and week views, lanes, event list and move and resize buttons are the shared ones, and the handles of a tall event are dragged with the pointer or stepped with the arrow keys, snapping to slotMinutes; times are read with Intl in timeZone, as on the Web. Events arrive and bump as elsewhere, but the neighbours of a moved event do not glide to their new lanes, and, as on every platform, the scheduler does not create events. See Desktop components.