Apps

Calendar

Month, week, day and agenda views with multi-day events, quick add, overlapping layout and an event popover.

composables/apps/useCalendar.ts
View in the demo

Events may span days (endDate) and carry location, meetingUrl, description and attendees. eventsByDate repeats a multi-day event on each day and CalendarEventChip joins it across cells.

Every app follows the same pattern: typed models in types/models/, demo data in mocks/, state and actions in a composable under composables/apps/, page-only components in components/pages/<app>/ and UI strings in locales/<code>/apps.json. Read the apps overview once and every app looks familiar.

Files

File
Role
pages/calendar.vueThe page: toolbar, views and the day panel.
composables/apps/useCalendar.tsEvents, visible calendars, range, quick add and layout helpers.
types/models/calendar.tsEvents, views and the provider.
config/calendar.config.tsCalendars, default view, visible hours and the first weekday.
mocks/calendar.mock.tsDemo events and createCalendarMockProvider().
components/pages/calendar/CalendarMonthView, CalendarTimeGrid, CalendarAgendaView, CalendarDayPanel, CalendarDaySlot, CalendarEventChip, CalendarEventPopover.

Data and provider

types/models/calendar.ts
export interface CalendarProvider {
  list: () => Promise<CalendarEvent[]>
  save: (event: CalendarEvent) => Promise<void>
  remove: (id: string) => Promise<void>
}

Connect your backend

The page calls useCalendar() with the mock provider. Write a provider that calls your API with useApi() and pass it in the page. The composable loads it through useAsyncData and applies every change optimistically, so the interface does not wait for the server.

providers/calendar.ts
import type { CalendarEvent, CalendarProvider } from '~/types/models/calendar'

export function createCalendarApiProvider(): CalendarProvider {
  const api = useApi()

  return {
    list: () => api<CalendarEvent[]>('/events'),
    save: (event) => api(`/events/${event.id}`, { method: 'PUT', body: event }),
    remove: (id) => api(`/events/${id}`, { method: 'DELETE' }),
  }
}
pages/calendar.vue
<script setup lang="ts">
import { createCalendarApiProvider } from '~/providers/calendar'

const { ... } = useCalendar({ provider: createCalendarApiProvider() })
</script>

Keep ids in your data and labels in the locales: folders, labels and tags resolve their names through apps.<app>.* unless you give them a raw title. See Connect your API for the token, validation errors and the actions the demo only fakes.

Configuration

CALENDARS

Calendars with their color and an optional raw title; otherwise apps.calendar.ids.<id>.

config/calendar.config.ts
const CALENDARS: CalendarConfig[]

CALENDAR_DEFAULT_VIEW

The first view. The user’s choice persists in the calendar-view cookie.

config/calendar.config.ts
const CALENDAR_DEFAULT_VIEW: CalendarViewSettings

CALENDAR_HOURS

The first and last hour of the week and day grids.

config/calendar.config.ts
const CALENDAR_HOURS: CalendarHours

CALENDAR_WEEK_STARTS_ON

The first day of the week (0 is Sunday).

config/calendar.config.ts
const CALENDAR_WEEK_STARTS_ON: 1

Rules

Pure functions in utils/, unit tested. Use them in your backend too if you want the same answers.

placeEvents()

Lays overlapping events side by side in the time grid.

composables/apps/useCalendar.ts
placeEvents(events: CalendarEvent[]): CalendarPlacedEvent[]

How it works

  • The page is a BaseSplitView (mode="none") whose aside is CalendarDayPanel: the selected day, a current-time line and the quick add field, parsed by quickAdd.
  • Below lg, picking a day opens the day view. The month grid shows dots instead of chips whenever a cell is narrower than 104px, so a laptop with the sidebar open gets dots too, and the calendar filter keeps only its dots while the toolbar is under 560px.
  • Clicking an event opens CalendarEventPopover, a BaseMenu anchored with target, with join, edit, duplicate and delete.
  • The calendar filter is a BaseMenuOptions with checkbox and dotColor.
  • Clicking an empty slot of the week or day grid creates an event at that half hour.
© 2026 melsami UI.
Developer documentation for melsami UI.