Schedule
Day, week and month scheduling in browser local time. Supports all-day and multi-day events, daily resource columns, pointer editing and keyboard editing. The page owns event data; the component requests changes through events.
Import
import { HuiSchedule } from '@nscode/handy-ui'
import type {
ScheduleEvent,
ScheduleResource,
ScheduleEventChange,
ScheduleSelection,
ScheduleExpose,
ScheduleView,
ScheduleRange
} from '@nscode/handy-ui'
Examples
Current week, exclusive ends and colors
Events are generated for the date the page opens. The current week and month therefore contain data. 09:00–10:00 does not overlap 10:00–11:00. All-day ends also exclude the final date. Multi-day timed events appear in the all-day row without duplicate timed rendering.
<script setup lang="ts">
import { ref } from 'vue'
import { HuiSchedule, HuiSpace } from '@nscode/handy-ui'
import type { ScheduleEvent, ScheduleView } from '@nscode/handy-ui'
const today = new Date()
today.setHours(0, 0, 0, 0)
const at = (hour: number, minute = 0, days = 0) => {
const date = new Date(today.getTime())
date.setDate(date.getDate() + days)
date.setHours(hour, minute, 0, 0)
return date
}
const date = ref(new Date(today.getTime()))
const view = ref<ScheduleView>('week')
const events: ScheduleEvent[] = [
{ id: 0, title: 'Meeting: 09:00–10:00', start: at(9), end: at(10) },
{ id: '0', title: 'Review: 10:00–11:00', start: at(10), end: at(11), color: 'success' },
{
id: 'all',
title: 'All day: today only',
start: at(0),
end: at(0, 0, 1),
allDay: true,
color: 'warning'
},
{ id: 'cross', title: 'Multi-day task', start: at(18), end: at(11, 0, 1), color: '#7c3aed' },
...['primary', 'success', 'warning', 'danger', 'info', 'help'].map((color, index) => ({
id: `color-${color}`,
title: color,
start: at(13, index * 10),
end: at(14, index * 10),
color
}))
]
</script>
<template>
<HuiSpace direction="vertical" fill>
<HuiSchedule v-model:view="view" v-model:date="date" :events="events" :height="420" />
<span>View: {{ view }}; number id=0 and string id='0' identify different events.</span>
</HuiSpace>
</template>
Room reservations, resources, conflict checks and methods
Day view uses one column per resource. Select an empty area or choose New reservation to open a Modal. Saving creates the event. Pointer and Alt-key edits pass through beforeEventChange; accepted changes replace only the target event by strict ID. Adjacent 09:00–10:00 and 10:00–11:00 events do not conflict. No removal, clear or reset action is included.
<script setup lang="ts">
import { computed, onBeforeUnmount, reactive, ref } from 'vue'
import {
HuiButton,
HuiCheckbox,
HuiForm,
HuiFormItem,
HuiInput,
HuiMessage,
HuiModal,
HuiSchedule,
HuiSelect,
HuiSpace,
HuiTag
} from '@nscode/handy-ui'
import type {
ScheduleEvent,
ScheduleEventChange,
ScheduleExpose,
ScheduleRange,
ScheduleResource,
ScheduleSelection,
ScheduleView
} from '@nscode/handy-ui'
const today = new Date()
today.setHours(0, 0, 0, 0)
const at = (day: Date, hour: number, minute = 0) => {
const date = new Date(day.getTime())
date.setHours(hour, minute, 0, 0)
return date
}
const addDays = (day: Date, count: number) => {
const date = new Date(day.getTime())
date.setDate(date.getDate() + count)
return date
}
const resources: ScheduleResource[] = [
{ id: 'room-a', title: 'Room A', color: 'primary' },
{ id: 'room-b', title: 'Room B', color: 'success' }
]
const events = ref<ScheduleEvent[]>([
{
id: 1,
title: 'Project meeting',
start: at(today, 9),
end: at(today, 10),
resourceId: 'room-a',
people: 6
},
{
id: 2,
title: 'Design review',
start: at(today, 10),
end: at(today, 11),
resourceId: 'room-a',
people: 4
},
{
id: 3,
title: 'User interview',
start: at(today, 9, 30),
end: at(today, 11),
resourceId: 'room-b',
people: 3
},
{
id: 4,
title: 'All-day training',
start: today,
end: addDays(today, 1),
allDay: true,
resourceId: 'room-b',
color: 'warning',
people: 12
},
{
id: 5,
title: 'Overnight preparation',
start: at(today, 18),
end: at(addDays(today, 1), 10),
resourceId: 'room-a',
color: '#7c3aed',
people: 2
},
{
id: 6,
title: 'Fixed reservation',
start: at(today, 8),
end: at(today, 8, 30),
resourceId: 'room-a',
editable: false,
color: 'info',
people: 1
},
{
id: 7,
title: 'Unassigned discussion',
start: at(today, 13, 30),
end: at(today, 14, 30),
people: 2
}
])
const schedule = ref<ScheduleExpose>()
const view = ref<ScheduleView>('day')
const date = ref(new Date(today.getTime()))
const editable = ref(true)
const selectable = ref(true)
const hideWeekends = ref(false)
const showNow = ref(true)
const work = ref(true)
const restrictedHours = ref(true)
const singleView = ref(false)
const loading = ref(false)
const firstDayOfWeek = ref(1)
const slotMinutes = ref<5 | 10 | 15 | 20 | 30 | 60>(30)
const slotHeight = ref(24)
const height = ref(420)
const maxEventsPerDay = ref(3)
const status = ref(
'Day view uses room columns; drag or use Alt+arrows to edit, and select empty space to create'
)
const moreEvents = ref<ScheduleEvent[]>([])
const views = computed<ScheduleView[]>(() =>
singleView.value ? [view.value] : ['day', 'week', 'month']
)
const weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
const firstDays = weekdays.map((label, value) => ({ label, value }))
const minuteChoices = [5, 10, 15, 20, 30, 60].map((value) => ({
label: `${value} minutes`,
value
}))
const heights = [16, 24, 32].map((value) => ({ label: `${value}px/slot`, value }))
const viewportHeights = [320, 420, 600].map((value) => ({ label: `Height ${value}px`, value }))
const maxChoices = [0, 1, 3, 5].map((value) => ({ label: `Month limit ${value} events`, value }))
const dateText = (value: Date) =>
`${value.getFullYear()}-${String(value.getMonth() + 1).padStart(2, '0')}-${String(value.getDate()).padStart(2, '0')}`
const stamp = (value: ScheduleEvent['start']) =>
value instanceof Date ? value.getTime() : new Date(value).getTime()
const overlaps = (
candidate: { start: Date; end: Date; resourceId?: string | number },
except?: string | number
) =>
events.value.some(
(event) =>
event.id !== except &&
event.resourceId === candidate.resourceId &&
stamp(event.start) < candidate.end.getTime() &&
stamp(event.end ?? addDays(new Date(stamp(event.start)), 1)) > candidate.start.getTime()
)
let alive = true
let nextId = 100
const checks = new Map<ReturnType<typeof setTimeout>, (accepted: boolean) => void>()
const beforeEventChange = (change: ScheduleEventChange) =>
new Promise<boolean>((resolve) => {
if (!alive) {
resolve(false)
return
}
const candidate = {
start: new Date(change.start.getTime()),
end: new Date(change.end.getTime()),
resourceId: change.resourceId
}
status.value = `Checking “${change.event.title}” for room conflicts; event data is unchanged`
const timer = setTimeout(() => {
checks.delete(timer)
if (!alive) {
resolve(false)
return
}
const conflict = overlaps(candidate, change.event.id)
status.value = conflict
? 'Conflicting room reservation; edit rejected'
: 'Approved; waiting for eventChange to update events'
if (conflict)
HuiMessage.warning('This room is already reserved; choose a different interval')
resolve(!conflict)
}, 300)
checks.set(timer, resolve)
})
const applyChange = (change: ScheduleEventChange) => {
if (!alive) return
events.value = events.value.map((event) =>
event.id === change.event.id
? {
...event,
start: new Date(change.start.getTime()),
end: new Date(change.end.getTime()),
allDay: change.allDay,
resourceId: change.resourceId
}
: event
)
status.value = `eventChange: saved “${change.event.title}”; other event references are unchanged`
}
const modalVisible = ref(false)
const draft = ref<ScheduleSelection>()
const form = reactive({ title: '' })
const select = (selection: ScheduleSelection) => {
if (!alive || modalVisible.value) return
draft.value = {
...selection,
start: new Date(selection.start.getTime()),
end: new Date(selection.end.getTime())
}
form.title = ''
modalVisible.value = true
status.value = 'select: enter a title; no event is added before saving'
}
const createFromToolbar = () =>
select({
start: at(date.value, 15),
end: at(date.value, 16),
allDay: false,
resourceId: 'room-a'
})
const save = () => {
if (!alive || !draft.value) return false
if (!form.title.trim()) {
HuiMessage.warning('Enter a reservation title')
return false
}
if (overlaps(draft.value)) {
HuiMessage.warning('Room interval conflicts; no reservation was added')
return false
}
events.value = [
...events.value,
{
id: nextId++,
title: form.title.trim(),
start: new Date(draft.value.start.getTime()),
end: new Date(draft.value.end.getTime()),
allDay: draft.value.allDay,
resourceId: draft.value.resourceId,
people: 1
}
]
status.value = `Created reservation “${form.title.trim()}”`
return true
}
const showRange = () => {
const range = schedule.value?.getRange()
if (range)
status.value = `getRange:${dateText(range.start)} to ${dateText(range.end)} (end exclusive)`
}
const rangeChange = (range: ScheduleRange) => {
status.value = `rangeChange:${range.view},${dateText(range.start)} to ${dateText(range.end)}`
}
const moreClick = (day: Date, items: ScheduleEvent[]) => {
moreEvents.value = items.slice()
status.value = `moreClick:${dateText(day)},${items.length} items`
}
onBeforeUnmount(() => {
alive = false
checks.forEach((resolve, timer) => {
clearTimeout(timer)
resolve(false)
})
checks.clear()
})
</script>
<template>
<HuiSpace direction="vertical" fill>
<HuiSpace wrap>
<HuiCheckbox v-model="editable">editable</HuiCheckbox
><HuiCheckbox v-model="selectable">selectable</HuiCheckbox>
<HuiCheckbox v-model="hideWeekends">Hide weekends</HuiCheckbox
><HuiCheckbox v-model="restrictedHours">Show 07:00–22:00</HuiCheckbox>
<HuiCheckbox v-model="work">Highlight 09:00–18:00</HuiCheckbox
><HuiCheckbox v-model="showNow">Current-time line</HuiCheckbox>
<HuiCheckbox v-model="singleView">Keep only the current toolbar view</HuiCheckbox
><HuiCheckbox v-model="loading">loading</HuiCheckbox>
</HuiSpace>
<HuiSpace wrap>
<HuiSelect
v-model="firstDayOfWeek"
:options="firstDays"
aria-label="First weekday"
style="width: 130px"
/>
<HuiSelect
v-model="slotMinutes"
:options="minuteChoices"
aria-label="Slot minutes"
style="width: 130px"
/>
<HuiSelect
v-model="slotHeight"
:options="heights"
aria-label="Slot height"
style="width: 130px"
/>
<HuiSelect
v-model="height"
:options="viewportHeights"
aria-label="Time-grid height"
style="width: 140px"
/>
<HuiSelect
v-model="maxEventsPerDay"
:options="maxChoices"
aria-label="Month event limit"
style="width: 150px"
/>
</HuiSpace>
<HuiSchedule
ref="schedule"
v-model:view="view"
v-model:date="date"
:events="events"
:views="views"
:resources="resources"
:first-day-of-week="firstDayOfWeek"
:hidden-days="hideWeekends ? [0, 6] : []"
:start-hour="restrictedHours ? 7 : 0"
:end-hour="restrictedHours ? 22 : 24"
:work-hours="work ? [9, 18] : null"
:slot-minutes="slotMinutes"
:slot-height="slotHeight"
:height="height"
:max-events-per-day="maxEventsPerDay"
:scroll-to-hour="8"
:editable="editable"
:selectable="selectable"
:before-event-change="beforeEventChange"
:show-now-indicator="showNow"
:loading="loading"
@event-change="applyChange"
@select="select"
@range-change="rangeChange"
@more-click="moreClick"
@event-click="(event) => (status = `eventClick:${event.title}`)"
@event-dblclick="(event) => (status = `eventDblclick:${event.title}`)"
>
<template #toolbar-extra
><HuiButton
class="schedule-demo-create"
size="small"
:disabled="!selectable || loading"
@click="createFromToolbar"
>New reservation</HuiButton
></template
>
<template #event="{ event, timeText }"
><span>{{ event.title }} · {{ event.people ?? 1 }} people</span
><small>{{ timeText }}</small></template
>
<template #day-header="{ date: day, isToday }"
><strong
>{{ weekdays[day.getDay()] }} {{ day.getDate() }}{{ isToday ? ' (Today)' : '' }}</strong
></template
>
<template #resource-header="{ resource }"
><HuiTag>{{ resource.title }}</HuiTag></template
>
<template #more="{ count }"
><span>Show {{ count }} items</span></template
>
</HuiSchedule>
<HuiSpace wrap>
<HuiButton size="small" @click="schedule?.prev()">prev()</HuiButton
><HuiButton size="small" @click="schedule?.next()">next()</HuiButton>
<HuiButton size="small" @click="schedule?.today()">today()</HuiButton
><HuiButton size="small" @click="schedule?.scrollToTime(14, 30)"
>scrollToTime(14, 30)</HuiButton
><HuiButton size="small" @click="showRange">getRange()</HuiButton>
</HuiSpace>
<span class="schedule-demo-status" role="status">{{ status }}</span>
<span class="schedule-demo-count">Events: {{ events.length }} items; view: {{ view }}</span>
<span v-if="moreEvents.length"
>Date events: {{ moreEvents.map((event) => event.title).join('、') }}</span
>
<span
>Ends are exclusive: 09:00–10:00 does not conflict with 10:00–11:00. The 300ms check is local;
application code cancels real requests. Escape cancels, Alt+arrows move, Alt+Shift+Up/Down
resize, and releasing Alt commits.</span
>
<HuiModal
v-model:visible="modalVisible"
title="New room reservation"
:before-confirm="save"
show-footer
confirm-button-text="Save reservation"
>
<HuiForm :model="form"
><HuiFormItem label="Title" prop="title"
><HuiInput
v-model="form.title"
class="schedule-demo-title"
placeholder="Enter reservation title" /></HuiFormItem
></HuiForm>
<span v-if="draft"
>{{ dateText(draft.start) }}; room:
{{
resources.find((resource) => resource.id === draft?.resourceId)?.title ?? 'Unassigned'
}};{{
draft.allDay
? 'All day'
: `${draft.start.getHours()}:${String(draft.start.getMinutes()).padStart(2, '0')} to ${draft.end.getHours()}:${String(draft.end.getMinutes()).padStart(2, '0')}`
}}</span
>
</HuiModal>
</HuiSpace>
</template>
Custom toolbar, day headers and event content
Toolbar callbacks come from the component rather than a second navigation state. The event slot receives the original application object. Segment flags identify actual start/end pieces of an event across clipped dates or weeks.
<script setup lang="ts">
import { ref } from 'vue'
import { HuiButton, HuiSchedule, HuiSpace } from '@nscode/handy-ui'
import type { ScheduleEvent, ScheduleView } from '@nscode/handy-ui'
const date = ref(new Date())
const view = ref<ScheduleView>('week')
const start = new Date()
start.setHours(9, 0, 0, 0)
const end = new Date(start.getTime())
end.setHours(10)
const events: ScheduleEvent[] = [{ id: 1, title: 'Custom meeting', start, end, people: 6 }]
const status = ref('Waiting for a click')
</script>
<template>
<HuiSpace direction="vertical" fill>
<HuiSchedule
v-model:view="view"
v-model:date="date"
:events="events"
:height="360"
@event-click="(event) => (status = event.title)"
>
<template #toolbar="{ title, view: active, views, prev, next, today, setView }">
<HuiSpace wrap
><HuiButton size="small" @click="prev">Previous</HuiButton
><HuiButton size="small" @click="today">Today</HuiButton
><HuiButton size="small" @click="next">Next</HuiButton><strong>{{ title }}</strong
><HuiButton
v-for="choice in views"
:key="choice"
size="small"
:type="choice === active ? 'primary' : 'default'"
@click="setView(choice)"
>{{ choice }}</HuiButton
></HuiSpace
>
</template>
<template #day-header="{ date: day, isToday }"
><strong
>{{ day.getMonth() + 1 }}/{{ day.getDate() }}{{ isToday ? ' Today' : '' }}</strong
></template
>
<template #event="{ event, timeText, segment }"
><span>{{ event.title }} ({{ event.people }} people)</span
><small
>{{ timeText }}; boundaries: {{ segment.isStart }}/{{ segment.isEnd }}</small
></template
>
</HuiSchedule>
<span role="status">{{ status }}</span>
</HuiSpace>
</template>
Month overflow: default list and moreClick handling
Without a moreClick listener the component opens the complete event list for that date. Adding a listener gives the page ownership of that presentation. The more slot replaces content only; its outer button keeps keyboard and click behavior. A limit of zero places all events in More.
<script setup lang="ts">
import { ref } from 'vue'
import { HuiSchedule, HuiSpace } from '@nscode/handy-ui'
import type { ScheduleEvent, ScheduleView } from '@nscode/handy-ui'
const dateA = ref(new Date())
const dateB = ref(new Date())
const viewA = ref<ScheduleView>('month')
const viewB = ref<ScheduleView>('month')
const events: ScheduleEvent[] = Array.from({ length: 6 }, (_, index) => {
const start = new Date()
start.setHours(9 + index, 0, 0, 0)
const end = new Date(start.getTime())
end.setHours(end.getHours() + 1)
return { id: index, title: `Event ${index + 1}`, start, end }
})
const selected = ref('No list opened yet')
const more = (date: Date, items: ScheduleEvent[]) => {
selected.value = `${date.toLocaleDateString()}: ${items.map((event) => event.title).join(', ')}`
}
</script>
<template>
<HuiSpace direction="vertical" fill>
<strong>Default list without a moreClick listener</strong
><HuiSchedule
v-model:view="viewA"
v-model:date="dateA"
:events="events"
:max-events-per-day="2"
/>
<strong>Page-owned list</strong
><HuiSchedule
v-model:view="viewB"
v-model:date="dateB"
:events="events"
:max-events-per-day="0"
@more-click="more"
><template #more="{ count }"
><span>Open {{ count }} events</span></template
></HuiSchedule
>
<span role="status">{{ selected }}</span>
</HuiSpace>
</template>
Controlled view/date and listener-only mode
The two props are independently controlled by presence. Rejecting updates preserves parent values. Listening to update events without binding the corresponding prop still allows internal navigation.
<script setup lang="ts">
import { ref } from 'vue'
import { HuiCheckbox, HuiSchedule, HuiSpace } from '@nscode/handy-ui'
import type { ScheduleView } from '@nscode/handy-ui'
const view = ref<ScheduleView>('week')
const date = ref(new Date())
const accept = ref(false)
const status = ref('The parent rejects updates')
const updateView = (value: ScheduleView) => {
status.value = `Requested view: ${value}`
if (accept.value) view.value = value
}
const updateDate = (value: Date) => {
status.value = `Requested date: ${value.toLocaleDateString()}`
if (accept.value) date.value = value
}
</script>
<template>
<HuiSpace direction="vertical" fill>
<HuiCheckbox v-model="accept">Accept view and date requests</HuiCheckbox>
<HuiSchedule
:view="view"
:date="date"
:height="260"
@update:view="updateView"
@update:date="updateDate"
/>
<span role="status">{{ status }}; parent view: {{ view }}</span>
<strong>Listener only: internal state</strong
><HuiSchedule
:height="260"
@update:view="(value) => (status = `Internal view: ${value}`)"
@update:date="(value) => (status = `Internal date: ${value.toLocaleDateString()}`)"
/>
</HuiSpace>
</template>
Range loading and stale result protection
The first range notification occurs after mounting, followed only by actual displayed-range changes. The mock request applies only its current revision. Unmount cancels its timer; application code must cancel real network requests.
<script setup lang="ts">
import { onBeforeUnmount, ref } from 'vue'
import { HuiButton, HuiSchedule, HuiSpace } from '@nscode/handy-ui'
import type { ScheduleEvent, ScheduleRange } from '@nscode/handy-ui'
const date = ref(new Date())
const events = ref<ScheduleEvent[]>([])
const loading = ref(false)
const status = ref('Waiting for a range')
let alive = true
let revision = 0
let timer: ReturnType<typeof setTimeout> | undefined
const load = (range: ScheduleRange) => {
const request = ++revision
clearTimeout(timer)
loading.value = true
const start = new Date(range.start.getTime())
start.setHours(10)
const end = new Date(start.getTime())
end.setHours(11)
status.value = `Loading ${range.start.toLocaleDateString()}–${range.end.toLocaleDateString()}, end exclusive`
timer = setTimeout(() => {
if (!alive || request !== revision) return
events.value = [{ id: 'loaded', title: 'Event returned for this range', start, end }]
loading.value = false
status.value = 'Current range loaded'
}, 500)
}
const jump = () => {
const next = new Date(date.value.getTime())
next.setDate(next.getDate() + 7)
date.value = next
}
onBeforeUnmount(() => {
alive = false
revision++
clearTimeout(timer)
})
</script>
<template>
<HuiSpace direction="vertical" fill
><HuiButton @click="jump">Jump one week externally; repeated clicks are allowed</HuiButton
><HuiSchedule
v-model:date="date"
:events="events"
:loading="loading"
:height="360"
@range-change="load"
/><span role="status">{{ status }}</span></HuiSpace
>
</template>
String format and narrow day view
Event and anchor strings share valueFormat. Emitted dates and changes remain Date objects. The narrow example uses flex:none to preserve its width. Responsive view switching belongs to the page and can use the existing breakpoint helper.
<script setup lang="ts">
import { ref, watch } from 'vue'
import { HuiSchedule, HuiSpace, useBreakpoint } from '@nscode/handy-ui'
import type { ScheduleView } from '@nscode/handy-ui'
const today = new Date()
const date = ref(new Date(today.getTime()))
const pad = (value: number) => String(value).padStart(2, '0')
const prefix = `${today.getFullYear()}-${pad(today.getMonth() + 1)}-${pad(today.getDate())}`
const events = [
{ id: 'text', title: 'String event', start: `${prefix} 09:00`, end: `${prefix} 10:00` }
]
const breakpoint = useBreakpoint()
const view = ref<ScheduleView>('day')
watch(
breakpoint,
(value) => {
view.value = value === 'xs' || value === 'sm' ? 'day' : 'week'
},
{ immediate: true }
)
</script>
<template>
<HuiSpace direction="vertical" fill
><span>Breakpoint: {{ breakpoint }}; view: {{ view }}</span
><HuiSchedule
v-model:view="view"
v-model:date="date"
:events="events"
value-format="YYYY-MM-DD HH:mm"
:start-hour="8"
:end-hour="18"
:height="320"
style="width: 340px; max-width: 100%; flex: none"
/></HuiSpace>
</template>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| events | ScheduleEvent[] | [] | External data; never mutated by the component |
| view | ScheduleView | Internal 'week' when omitted | day/week/month; controlled by prop presence |
| views | ScheduleView[] | ['day','week','month'] | Available toolbar views; one choice hides the switch |
| date | ScheduleTime | Creation-time local today when omitted | Anchor date; v-model:date; emitted values are Date |
| resources | ScheduleResource[] | [] | Resource columns in day view only |
| firstDayOfWeek | number | 1 | 0–6, Monday by default; differs from the date picker's default |
| hiddenDays | number[] | [] | Hidden local weekdays; 0 Sunday, 6 Saturday |
| startHour | number | 0 | Start of visible time axis |
| endHour | number | 24 | End hour; 24 is next local midnight |
| workHours | [number, number] | null | [9,18] | Work interval; null disables highlighting |
| slotMinutes | 5 | 10 | 15 | 20 | 30 | 60 | 30 | Grid minutes and editing snap interval |
| slotHeight | number | 24 | Grid slot height in pixels |
| height | number | string | 600 | Scrollable time-grid height; numbers use px |
| scrollToHour | number | 8 | Initial scroll hour when opening the time grid |
| maxEventsPerDay | number | 3 | Month lane limit; zero puts all events in More |
| editable | boolean | false | Move, resize and Alt-key editing |
| selectable | boolean | false | Clicking/dragging empty areas emits select |
| beforeEventChange | (change) => boolean | void | Promise<boolean | void> | — | Only false, throws and rejection block |
| showNowIndicator | boolean | true | Current-time line in today's column only |
| valueFormat | string | — | Parse event/anchor strings like DatePicker; x milliseconds/X seconds |
| loading | boolean | false | Loading mask; blocks navigation and editing |
Events
| Event | Parameters | Description |
|---|---|---|
| update:view | view: ScheduleView | View request, including uncontrolled mode |
| update:date | date: Date | Anchor request, including uncontrolled mode |
| rangeChange | range: ScheduleRange | Initial mount and actual range changes; end exclusive |
| eventClick | event: ScheduleEvent, nativeEvent: MouseEvent | KeyboardEvent | Original event object; also emitted on Enter |
| eventDblclick | event: ScheduleEvent, nativeEvent: MouseEvent | Double-click event |
| eventChange | change: ScheduleEventChange | Approved move/resize; the page must update events |
| select | selection: ScheduleSelection | Selected half-open interval; no event is created automatically |
| moreClick | date: Date, events: ScheduleEvent[] | Month More action; a listener replaces the default list |
Use kebab-case listeners in templates: @range-change, @event-click, @event-dblclick, @event-change and @more-click. Declarations use camelCase and application event objects retain their references.
Slots
| Slot | Parameters | Description |
|---|---|---|
| event | { event, view, start, end, timeText, segment } | Event content; outer focus/editing semantics remain intact |
| toolbar | { title, view, views, prev, next, today, setView } | Complete toolbar |
| toolbar-extra | — | Extra content in the default toolbar; useful for keyboard creation |
| day-header | { date, isToday } | Date header |
| resource-header | { resource } | Daily resource header |
| more | { date, events, count } | More button content; avoid nesting another button |
Methods
Use ref<ScheduleExpose>().
| Method | Description |
|---|---|
| prev() | Previous day/week/month |
| next() | Next day/week/month |
| today() | Return the anchor to local today |
| scrollToTime(hour, minute?) | Scroll the day/week time grid; minute defaults to zero |
| getRange() | Independent { start, end, view } snapshot; end exclusive |
Types
type ScheduleView = 'day' | 'week' | 'month'
type ScheduleTime = Date | string | number
interface ScheduleEvent {
id: string | number
title: string
start: ScheduleTime
end?: ScheduleTime
allDay?: boolean
color?: string
resourceId?: string | number
editable?: boolean
[key: string]: unknown
}
interface ScheduleResource {
id: string | number
title: string
color?: string
}
interface ScheduleEventChange {
event: ScheduleEvent
start: Date
end: Date
allDay: boolean
resourceId?: string | number
type: 'move' | 'resize'
}
interface ScheduleSelection {
start: Date
end: Date
allDay: boolean
resourceId?: string | number
}
interface ScheduleRange {
start: Date
end: Date
view: ScheduleView
}
Also exports ScheduleProps, ScheduleEmits, ScheduleSlots, ScheduleExpose, ScheduleEventSegment, ScheduleEventSlotProps and ScheduleToolbarSlotProps. Internal normalized data is not part of the public entry.