CalendarsAPI ReferenceHooks & API· 5 min read
Calendar API, Theming & Modifiers Hook
Comprehensive API reference for @quatick/calendar: useCalendarModifier hook, theme presets, density modes, view switching, and ICS export.
The @quatick/calendar engine provides a full programmatic API through the useCalendarModifier hook and CalendarThemeProvider. Applications can programmatically navigate dates, switch between 5 view modes, adjust density, undo/redo state changes, and export to RFC 5545 iCalendar (.ics) files.
Density Modes
| Density Mode | Row Height | Font Scale | Best Suited For |
|---|---|---|---|
| compact | 28px / hour | 11px (Mono) | High-frequency financial trading desks with dense multi-event days |
| comfortable | 44px / hour | 13px (Sans) | Standard SaaS portals, enterprise project planning, and dashboards (Default) |
| spacious | 64px / hour | 15px (Sans) | Tablets, mobile touchscreens, and executive presentation screens |
Programmatic Hook: useCalendarModifier
calendar-toolbar.tsx
1
import React from 'react';
2
import { useCalendarModifier } from '@quatick/calendar';
3
4
export function CalendarControls() {
5
const {
6
currentDate,
7
currentView,
8
setView,
9
goToToday,
10
next,
11
prev,
12
undo,
13
redo,
14
canUndo,
15
canRedo,
16
exportToICS,
17
} = useCalendarModifier();
18
19
return (
20
<div className="flex items-center justify-between p-3 border-b border-line">
21
<div className="flex items-center gap-2">
22
<button onClick={prev} className="px-2 py-1 rounded border border-line">Prev</button>
23
<button onClick={goToToday} className="px-3 py-1 rounded bg-accent text-white font-medium">Today</button>
24
<button onClick={next} className="px-2 py-1 rounded border border-line">Next</button>
25
</div>
26
27
<div className="flex gap-1 bg-subtle p-1 rounded-lg">
28
{(['year', 'month', 'week', 'day', 'agenda'] as const).map((view) => (
29
<button
30
key={view}
31
onClick={() => setView(view)}
32
className={`px-3 py-1 rounded text-xs capitalize ${currentView === view ? 'bg-surface shadow text-fg' : 'text-fg-muted'}`}
33
>
34
{view}
35
</button>
36
))}
37
</div>
38
39
<div className="flex items-center gap-2">
40
<button onClick={undo} disabled={!canUndo} className="p-1 disabled:opacity-30">Undo</button>
41
<button onClick={redo} disabled={!canRedo} className="p-1 disabled:opacity-30">Redo</button>
42
<button onClick={exportToICS} className="px-3 py-1 rounded border border-line text-xs">Export .ICS</button>
43
</div>
44
</div>
45
);
46
}