What is @fullcalendar/common?
@fullcalendar/common is a core package for the FullCalendar library, which provides a highly customizable and feature-rich calendar component for web applications. It includes utilities and base components that are used to build various calendar views and functionalities.
What are @fullcalendar/common's main functionalities?
Rendering a Basic Calendar
This code demonstrates how to render a basic calendar using the @fullcalendar/common package. It initializes a calendar with a month view and renders it in the specified HTML element.
import { Calendar } from '@fullcalendar/common';
const calendarEl = document.getElementById('calendar');
const calendar = new Calendar(calendarEl, {
initialView: 'dayGridMonth'
});
calendar.render();
Adding Events
This code sample shows how to add events to the calendar. The events array contains objects with event details such as title, start date, and end date.
import { Calendar } from '@fullcalendar/common';
const calendarEl = document.getElementById('calendar');
const calendar = new Calendar(calendarEl, {
initialView: 'dayGridMonth',
events: [
{ title: 'Event 1', start: '2023-10-01' },
{ title: 'Event 2', start: '2023-10-05', end: '2023-10-07' }
]
});
calendar.render();
Customizing Event Appearance
This example demonstrates how to customize the appearance of events by setting properties like color. Each event object can have additional properties to control its look and feel.
import { Calendar } from '@fullcalendar/common';
const calendarEl = document.getElementById('calendar');
const calendar = new Calendar(calendarEl, {
initialView: 'dayGridMonth',
events: [
{ title: 'Event 1', start: '2023-10-01', color: 'red' },
{ title: 'Event 2', start: '2023-10-05', end: '2023-10-07', color: 'blue' }
]
});
calendar.render();
Other packages similar to @fullcalendar/common
react-big-calendar
react-big-calendar is a similar package that provides a calendar component for React applications. It offers a range of views (month, week, day) and supports event handling. Compared to @fullcalendar/common, react-big-calendar is more tightly integrated with React and may be easier to use in React projects.
tui-calendar
tui-calendar is a JavaScript calendar library that provides various views and features like drag-and-drop, recurring events, and customizable themes. It is similar to @fullcalendar/common in terms of functionality but offers a different API and styling options.
fullcalendar
fullcalendar is the main package that includes @fullcalendar/common along with other modules for different views and functionalities. It provides a comprehensive solution for calendar needs in web applications, with extensive customization options and a wide range of features.
6.0.0-beta.1 (2022-08-03)
FullCalendar no longer attempts to import .css files. Instead, FullCalendar's JS is responsible for
injecting its own CSS. This solves many issues with third party libraries:
- Webpack: no longer necessary to use css-loader
(see [example project][webpack-css-hack])
- Rollup: no longer necessary to use a css-processing plugin (like postcss)
(see [example project][rollup-css-hack])
- NextJS: no longer necessary to ignore and manually import .css files
(see [example project][next-css-hack], #6674)
- Angular 14 is incompatible with FullCalendar v5 ([see ticket][angular-css-bug]). FullCalendar v6
restores support for Angular 14 and above, but does so via a completely different package. Please
use the new FullCalendar Web Component package (
@fullcalendar/web-component
), which can
integrate with Angular via the [method described here][angular-web-components].