A fully customizable, strongly-typed calendar module for Nuxt with i18n, timezone support, .ics export/import.
npm install nuxt-calendar[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href]
[![Nuxt][nuxt-src]][nuxt-href]
A powerful, production-ready calendar module for Nuxt 3 & 4 with comprehensive features for building modern calendar applications.
- 🎯 Strongly Typed - Full TypeScript support with comprehensive type definitions
- 🧩 Modular Architecture - Composable API design for maximum flexibility
- 🎨 Highly Customizable - Extensive configuration options for UI and behavior
- 🚀 Best DX - Auto-imported composables and components with full IDE support
- 🌍 Internationalization - Built-in i18n with date-fns locale support
- 🌐 Timezone Support - Full timezone handling with date-fns-tz
- 📅 ICS Export - Generate and download .ics files for calendar events
- 💾 Database Sync - Optional PostgreSQL integration via NuxtHub
- 🎯 Multiple Views - Day, week, and month calendar views
- ⚡ Performance - Optimized rendering with Vue 3 composition API
- 🎨 Nuxt UI Integration - Seamless integration with Nuxt UI components
``bash`
npx nuxi module add nuxt-calendar
Or install manually:
`bash`
npm install nuxt-calendaror
pnpm add nuxt-calendaror
yarn add nuxt-calendar
Add the module to your nuxt.config.ts:
`ts`
export default defineNuxtConfig({
modules: ['nuxt-calendar'],
NuxtCalendar: {
// Optional configuration
timeFormat: '24h',
i18n: {
locale: 'en',
timezone: 'UTC',
weekStartsOn: 1, // Monday
},
enableIcsExport: true,
enableDatabaseSync: false,
},
})
Use in your components:
`vue
:teams="teams"
@event-click="handleEventClick"
/>
`
`ts`
interface ModuleOptions {
// License key for commercial features (optional)
licenseKey?: string
// Time format for display
timeFormat?: '12h' | '24h'
// Team/calendar configuration
teams?: Team[]
// Company branding
company?: {
name: string
logo: string
}
// Internationalization settings
i18n?: {
locale: string // 'en', 'nl', 'de', 'fr', etc.
timezone: string // IANA timezone identifier
weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 // 0 = Sunday, 1 = Monday
}
// Enable ICS file export functionality
enableIcsExport?: boolean
// Enable database sync with NuxtHub
enableDatabaseSync?: boolean
}
`ts`
{
timeFormat: '24h',
i18n: {
locale: 'en',
timezone: 'UTC',
weekStartsOn: 1,
},
enableIcsExport: true,
enableDatabaseSync: false,
}
`vue
`
`vue
`
`vue`
First, enable database sync in your config:
`ts`
// nuxt.config.ts
export default defineNuxtConfig({
NuxtCalendar: {
enableDatabaseSync: true,
},
})
Then use the composable:
`vue`
`vue`
Access the calendar configuration:
`ts`
const config = useNuxtCalendarConfig()
console.log(config.timeFormat) // '24h'
console.log(config.i18n.locale) // 'en'
Export calendar events to ICS format:
`ts
const { exportToIcs, exportToIcsServer } = useCalendarIcs()
// Client-side export (downloads file)
await exportToIcs(events, 'calendar.ics')
// Server-side export (returns ICS data)
const { data } = await exportToIcsServer(events)
`
Sync calendar events with database:
`ts
const { fetchEvents, createEvent, updateEvent, deleteEvent } = useCalendarDatabase()
const result = await fetchEvents()
if (result.success) {
console.log(result.events)
}
`
Handle internationalization and timezones:
`ts
const { locale, timezone, weekStartsOn, formatDate, toLocalTimezone } = useCalendarI18n()
const formatted = formatDate(new Date(), 'yyyy-MM-dd HH:mm')
`
Manage calendar grid height:
`ts`
const { hourHeight, getEventTop, getEventHeight } = useCalendarSlotHeight()
The module supports all locales available in date-fns. Configure via:
`ts`
NuxtCalendar: {
i18n: {
locale: 'en', // or 'nl', 'de', 'fr', 'es', 'it', 'pt', 'ja', 'zh', 'ko', 'ru', etc.
},
}
Full IANA timezone database support including:
- UTC
- America/* (New_York, Los_Angeles, Chicago, etc.)
- Europe/* (London, Paris, Berlin, etc.)
- Asia/* (Tokyo, Shanghai, Dubai, etc.)
- Australia/* (Sydney, Melbourne, etc.)
- And many more...
`ts`
interface CalendarEvent {
id: string | number
title: string
start: Date
end: Date
description?: string
location?: string
organizer?: {
name: string
email: string
}
attendees?: Array<{
name: string
email: string
rsvp?: boolean
}>
meetLink?: string
category?: string
teamMemberIds?: (string | number)[]
}
When features are enabled, the module provides these endpoints:
- POST /api/nuxt-calendar/export/ics - Generate ICS file from events
- GET /api/nuxt-calendar/events - Fetch all eventsPOST /api/nuxt-calendar/events
- - Create a new eventPUT /api/nuxt-calendar/events/:id
- - Update an eventDELETE /api/nuxt-calendar/events/:id
- - Delete an event
The module is fully typed with comprehensive TypeScript definitions. All types are auto-imported:
`ts``
import type {
CalendarEvent,
Team,
TeamMember,
View,
SlotHeightConfig,
NuxtCalendarPublicConfig,
} from '#imports'
Contributions are welcome! Please see the repository for more details.
[npm-version-src]: https://img.shields.io/npm/v/nuxt-calendar/latest.svg?style=flat&colorA=020420&colorB=00DC82
[npm-version-href]: https://npmjs.com/package/nuxt-calendar
[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-calendar.svg?style=flat&colorA=020420&colorB=00DC82
[npm-downloads-href]: https://npm.chart.dev/nuxt-calendar
[license-src]: https://img.shields.io/npm/l/nuxt-calendar.svg?style=flat&colorA=020420&colorB=00DC82
[license-href]: https://npmjs.com/package/nuxt-calendar
[nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js
[nuxt-href]: https://nuxt.com