@super-calendar/native
v2.23.1
Published
Gesture-driven, virtualized month / week / day calendar and date picker for React Native (and web via react-native-web).
Maintainers
Readme
@super-calendar/native
The React Native renderer for super-calendar: a gesture-driven, virtualized month / week / day calendar and date picker. Runs on iOS, Android, and web (web via react-native-web).
- 📆 Month grid plus day / 3-day / week / custom-N time grids and an agenda
- 🤏 Pinch-to-zoom week/day grid (UI thread, no re-renders)
- ✋ Drag to select, create, and move: by time on the week/day grid, by whole days on the month and year grids
- ♾️ Virtualized, snap-paging views via
@legendapp/list - 🧩 Bring-your-own event type (
CalendarEvent<T>) and arenderEventescape hatch - 🪝 Headless
useMonthGridanduseDateRangefor fully custom UIs - 🎨 Themeable, with a
darkThemepreset
All-day spans
In the time grid, an all-day event renders once as a bar across the visible
dates it covers. Overlapping events stack on separate rows. The end is
exclusive, and hidden days take no width. renderEvent and press callbacks
receive the original event; continuesBefore and continuesAfter indicate
clipping at the bar's left and right edges. The default bar squares its corners on a
continuing side. The allDayColumn slot styles one
spanning cell. Timed events that cross midnight keep their per-day segments by
default (multiDayTimedEventPlacement="grid"); set
multiDayTimedEventPlacement="all-day" on Calendar or TimeGrid to place
timed events lasting 24 hours or longer in the all-day lane with their start
time and title while keeping shorter cross-midnight events on the grid.
With onDragEvent, a long press picks a lane bar up to move it to other
visible days.
Install
npm install @super-calendar/nativeAlso on JSR: deno add jsr:@super-calendar/native.
Peer dependencies: @legendapp/list (>=3.7.1), date-fns (>=3), react (>=19), react-native (>=0.74 <2), react-native-gesture-handler (>=2), react-native-reanimated (>=4), and react-native-worklets (>=0.8).
For a picker-only bundle that does not require Reanimated, import from the @super-calendar/native/picker subpath.
Usage
import { useState } from "react";
import { Calendar, type CalendarEvent } from "@super-calendar/native";
type MyEvent = { id: string; color: string };
const events: CalendarEvent<MyEvent>[] = [
{
id: "1",
color: "#1F6FEB",
title: "Lecture",
start: new Date(2026, 5, 19, 10, 0),
end: new Date(2026, 5, 19, 11, 30),
},
];
export function MyCalendar() {
const [mode, setMode] = useState<"month" | "week" | "day">("week");
const [date, setDate] = useState(new Date());
return (
<Calendar
mode={mode}
date={date}
events={events}
weekStartsOn={1}
onChangeDate={setDate}
onPressEvent={(event) => console.log(event.id)}
onPressDay={(day) => {
setDate(day);
setMode("day");
}}
/>
);
}date is controlled: update it from onChangeDate. If you leave it unchanged, a
swipe pages back to the date you kept.
Right-to-left layout
Pass isRTL to Calendar or any view to lay it out right to left. Days and
weekday headers run right to left, the time grid's hour gutter sits on the
right, and drags and edge paging follow the screen. A right swipe pages to the
next period without I18nManager. Under isRTL, a lane bar's
continuesAfter marks the edge where it started before the view.
isRTL mirrors the calendar by itself. When I18nManager.isRTL is also true,
React Native flips rows and horizontal lists too, so the two can cancel out.
Check the layout on a device before combining them.
Multi-week grids
Use mode="multiweek" with numberOfWeeks (default 2) for consecutive full
week rows without hourly slots. The first week contains date and aligns to
weekStartsOn. Navigation moves by the full number of weeks. hiddenDays only
shortens rows; custom views remain hourly even above seven columns.
import { useState } from "react";
import { Calendar } from "@super-calendar/native";
export function MultiWeekCalendar() {
const [date, setDate] = useState(new Date(2026, 11, 28));
return (
<Calendar
mode="multiweek"
numberOfWeeks={3}
weekStartsOn={1}
date={date}
onChangeDate={setDate}
events={[]}
onPressEvent={(event) => console.log(event.title)}
/>
);
}MultiWeekView exposes a standalone window with the month grid's event bars,
overflow, selection, drag interactions, and styling. Pass expanded events to it;
Calendar handles recurrence and time zones. Custom event renderers receive
mode: "multiweek". Week rows share the available height and scroll vertically
when their contents need more room. Dates align at the top of each cell so bars
and overflow labels line up across days.
Counts must be positive safe integers whose date span is representable; invalid
counts or dates throw RangeError. Rows are materialized, so larger counts need
more space. MonthView and MonthPager retain their month-only behavior.
Every mode, including schedule, highlights today as now and timeZone read
it. Pass activeDate to Calendar, MonthView, MultiWeekView, MonthList,
TimeGrid, YearView, or Agenda to highlight another day instead.
Screen-reader labels still announce the real today.
Keep events stable during unrelated UI updates. With recurrence or timeZone,
replacing the array rebuilds displayed events and cancels a held move on web. See
keep event data stable.
Vertical scrolling
In a day or week grid, set timeGridContentPaddingBottom to leave scrollable
space below the last hour. Set timeGridBounces={false} to turn off overscroll.
Use onTimeGridScroll to read contentOffset, contentSize, and
layoutMeasurement from event.nativeEvent on the JavaScript thread.
On the standalone TimeGrid, the same props are contentPaddingBottom,
verticalBounces, and onVerticalScroll. Both callbacks receive a
VerticalScrollEvent.
Moving events
Pass onDragEvent and update your event state with the returned start and end.
On the time grid, dragging any segment of a multi-day event previews the whole
range moving together and preserves its duration. Drag a resize grip to change
only the start or end. In month and multi-week views, a preview
of the moved event spans every day it would cover, and your month event renderer
draws it with the shifted start and end. See the dragging guide.
While you move or resize a time-grid event, renderEvent receives a copy of the event whose start and end
are the times the drop would report, so the label updates as you drag. It
re-renders only when the snapped times change. Compare events by a stable ID
inside a renderer. After a drag pages the view, the floating preview keeps the
stored times until release.
After edge paging, the floating event's horizontal centre selects the destination day, and its top edge selects the time.
Pass getEventId={(event) => event.id} when a refresh replaces event objects.
The event with the same ID keeps its rendered content and any held move,
resize, or all-day drag, and onDragEvent receives the current object. Return a
stable, unique string or number per event or recurring occurrence. The
deprecated keyExtractor still sets rendering keys; getEventId takes
precedence when you pass both.
Set an event's dragHandleColor to colour its resize grips in TimeGrid and
ResourceTimeline (both orientations). It defaults to theme.colors.eventText.
showDragHandle={false} still hides the time-grid grips.
You can toggle it after mounting without replacing the events array.
Current-time label
Pass renderNowLabel to Calendar or TimeGrid to show a label beside the
current-time line. The callback receives the time in the calendar's timeZone.
When the line is visible, a custom label replaces hour labels less than
15 minutes away. Return null to keep the ordinary hour labels.
Creating events
Pass onCreateEvent to long-press and sweep out a new event. To show a draft in
the preview while it is swept, add a renderCreateGhost component. It receives
the start and end that onCreateEvent would get on release and updates each
time the sweep crosses a snap step:
import { Calendar, type CreateGhostArgs } from "@super-calendar/native";
import { format } from "date-fns";
import { Text } from "react-native";
function DraftPreview({ start, end }: CreateGhostArgs) {
return <Text>{`New event ${format(start, "HH:mm")} - ${format(end, "HH:mm")}`}</Text>;
}
<Calendar mode="week" /* ... */ onCreateEvent={createEvent} renderCreateGhost={DraftPreview} />;TimeGrid and ResourceTimeline accept the same prop; ResourceTimeline also
passes the lane's resource. The preview geometry stays on the UI thread, and
the content is clipped to it and hidden from screen readers.
A cancelled gesture clears the preview without calling onCreateEvent.
MonthView, MultiWeekView, MonthPager, and Calendar in month or
multiweek mode also accept renderCreateGhost. These views pass the full
all-day range, with an exclusive end, and render one copy per covered week row.
Use date labels rather than times for this content. The preview updates when
the sweep reaches another day, uses chipHeight, chipGap, and the
createGhost slot, and sits on the top lane from the first day of the sweep,
moving the bars it overlaps down one lane without changing the row height. Content is
clipped, ignores pointer input, and is hidden from screen readers. On React Native Web, it also stays out of the tab order. Both the renderer and onCreateEvent are required; together they also
show the event-grid layout in an empty month. Omitting the renderer preserves
the existing day highlight.
Styling with Tailwind
Every styleable part is a named slot that accepts a class (resolved by a Tailwind runtime such as uniwind or NativeWind) and/or a style override. A classed slot drops its built-in themed styles, so your classes own the look:
<Calendar
mode="month"
date={date}
events={events}
classNames={{
title: "text-center text-xl font-bold text-indigo-900",
weekday: "uppercase tracking-wider text-indigo-400",
}}
styles={{ more: { color: "#6366F1" } }}
onChangeDate={setDate}
onPressEvent={(event) => console.log(event.id)}
/>See the styling guide for the slot list and the uniwind setup.
chipHeight and chipGap configure month lanes and overflow rows on Calendar,
MonthView, and MonthList. Native MonthPager forwards them too. DOM defaults
remain 18 px height and 2 px gaps; native height keeps its theme default.
Changing either dimension updates already mounted list and pager months.
See the month guide.
Docs for coding agents
This package includes its docs as Markdown in docs/, matched to the installed
version. Add a line like this to your project's AGENTS.md:
Read node_modules/@super-calendar/native/docs/llms.txt before writing calendar code.Documentation
See the full documentation and the quickstart, including theming, recurring events, time zones, and the headless picker.
License
MIT
