Vue Cal

4.10.2 · maintenance · verified Sun Apr 19

Vue Cal is a lightweight and highly customizable full calendar component for Vue.js applications, currently in its stable version 4.10.2. A key differentiator is its 'no dependency' philosophy, aiming for minimal footprint and maximum flexibility. It offers various views (day, week, month, year), robust event management including adding, editing, dragging, and resizing events, and extensive customization options through slots and CSS. While version 4.x is considered stable and suitable for production, it is no longer actively maintained. Development has shifted to version 5, which is a complete rewrite available under the `@next` tag and housed in a new repository. Users should be aware that future updates and new features will be for v5, and migrating from v4 to v5 will involve breaking changes due to its rebuilt architecture. The project emphasizes separating logic and styles, providing minimal CSS for easy overriding.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates a basic Vue Cal setup in a Vue 3 Composition API component, including event data, a custom theme, and essential styling for proper display.

<template>
  <div class="calendar-container">
    <VueCal 
      class="vuecal--blue-theme"
      :selected-date="new Date()"
      :time-step="30"
      :disable-views="['years', 'year']"
      :events="events"
      @ready="onCalendarReady"
      @event-create="onEventCreate"
    />
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import VueCal from 'vue-cal';
import 'vue-cal/dist/vuecal.css';

const events = ref([
  {
    start: new Date(new Date().setHours(10, 0, 0, 0)).toISOString(),
    end: new Date(new Date().setHours(11, 30, 0, 0)).toISOString(),
    title: 'Meeting with John',
    content: 'Discuss project roadmap.',
    class: 'leisure'
  },
  {
    start: new Date(new Date().setHours(14, 0, 0, 0)).toISOString(),
    end: new Date(new Date().setHours(15, 0, 0, 0)).toISOString(),
    title: 'Team Sync',
    content: 'Weekly team catch-up.',
    class: 'work'
  }
]);

function onCalendarReady() {
  console.log('Vue Cal is ready!');
}

function onEventCreate(event: any) {
  console.log('Event created:', event);
  // In a real app, you'd typically add the event to your `events` array or backend.
}
</script>

<style>
.calendar-container {
  height: 600px; /* Crucial: Vue Cal needs a defined height */
  max-width: 900px;
  margin: auto;
}
.vuecal__event.leisure {
  background-color: #a3c4f3;
  border: 1px solid #75a7f0;
  color: #fff;
}
.vuecal__event.work {
  background-color: #90ee90;
  border: 1px solid #6cdd6c;
  color: #fff;
}
</style>

view raw JSON →