Essentials

Components

Learn how to use the NuxtCalendar component and its props.

The <NuxtCalendar /> component is the main entry point for the UI. It provides a full-featured calendar interface with day, week, and month views.

Basic Usage

<template>
  <NuxtCalendar :events="events" />
</template>

<script setup lang="ts">
const events = ref([
  {
    id: 1,
    title: 'Meeting',
    start: new Date(),
    end: new Date(Date.now() + 3600000)
  }
])
</script>

Props

PropTypeDefaultDescription
eventsCalendarEvent[][]Array of event objects to display.
teamsTeam[][]Array of teams for filtering and color-coding. (Pro)
slotHeightnumber48Height of each 30-minute slot in pixels.
view`'day''week''month'`

Events

The component emits several events that you can listen to:

@event-click

Fired when a user clicks on an event.

<NuxtCalendar @event-click="(event) => console.log('Clicked:', event)" />

@event-change

Fired when an event is modified (e.g., dragged to a new time).

<NuxtCalendar @event-change="(event) => updateEventInDatabase(event)" />

@event-delete

Fired when a user deletes an event from the UI.

<NuxtCalendar @event-delete="(event) => removeEventFromDatabase(event.id)" />

Customizing the View

You can control the current date and view mode using v-model:

<template>
  <NuxtCalendar 
    v-model:selected-date="currentDate"
    v-model:view="currentView"
    :events="events"
  />
</template>

<script setup lang="ts">
const currentDate = ref(new Date())
const currentView = ref('day')
</script>

Responsive Design

The component is fully responsive. On mobile devices, it automatically switches to a list view or a simplified day view to ensure a great user experience on small screens.