Getting started
Installation
Install the React, the Vue or the Angular package, which brings the core and re-exports it, and import each opt-in feature from its own entry.
Each framework has one package, which depends on the core @fragiola/calendar (at the exact same
version) and re-exports all of it, so an app installs and imports one package: the Calendar.*
primitives, the hooks or composables, the model and every core type.
Install the package
A React app installs @fragiola/calendar-react:
pnpm add @fragiola/calendar-reactreact and react-dom (^19) are peer dependencies: your app provides them.
Each package has no other runtime dependency, and ships ES modules only, with their type declarations.
Import the parts
The primitives are one namespace, Calendar; the hooks, the model and every core type are named
exports of the same package:
import {
Calendar,
createCalendarModel,
useCalendarTitle,
type CalendarEventJson,
} from "@fragiola/calendar-react";Import a feature from its entry
What not every calendar needs is an opt-in feature, each on its own entry, so a calendar that
does not drag never ships the drag code. An entry exports the feature's factory, its parts and
its hooks (composables in Vue, directives and injection functions in Angular). The entries are
the same in every package (@fragiola/calendar-vue/selection,
@fragiola/calendar-angular/selection, …):
| entry | factory | parts and hooks |
|---|---|---|
@fragiola/calendar-react/selection | selection() | Selection, useSelection |
@fragiola/calendar-react/drag-and-drop | dragAndDrop() | DragPreview, useDragPreview |
@fragiola/calendar-react/resize | resize() | ResizeHandle, DragPreview, useDragPreview |
@fragiola/calendar-react/external-drop | externalDrop() | |
@fragiola/calendar-react/now-indicator | nowIndicator() | NowIndicator, useNowPosition |
@fragiola/calendar-react/constraints | constraints() | BusinessHours, useBusinessHours |
@fragiola/calendar-react/recurrence | recurrence() | |
@fragiola/calendar-react/event-sources | eventSources() |
import { dragAndDrop, DragPreview } from "@fragiola/calendar-react/drag-and-drop";
import { selection } from "@fragiola/calendar-react/selection";
const features = [selection(), dragAndDrop()] as const;Features explains how a model takes them.
Without a framework
The core is published on its own as @fragiola/calendar, for code that renders nothing: handling
calendar JSON on a server, a script or a test that runs no framework.
pnpm add @fragiola/calendarimport { createCalendarModel, type CalendarDocument } from "@fragiola/calendar";An app never needs it: it comes with its framework's package. The framework-neutral snippets of these docs (the model, the commands, the JSON, the date helpers) import from the core; in an app, the same names come from its framework's package.
Using it beside Fragiola Primitives
@fragiola/primitives-react also exports a Calendar: its date picker. In a file that uses
both, alias one of them:
import { Calendar } from "@fragiola/calendar-react";
import { Calendar as DatePicker } from "@fragiola/primitives-react";A date the date picker gives ({ year, month, day }) is the calendar's PlainDate too, so it
goes to view.go-to with no conversion:
model.run("view.go-to", { date: { year: 2026, month: 11, day: 26 } });The team planner example puts the two side by side.