### Install @super-calendar/core dependencies Source: https://super-calendar.afonsojramos.me/guides/headless Install the core engine and date-fns for date manipulation. ```bash npm install @super-calendar/core date-fns ``` -------------------------------- ### Install @super-calendar/dom dependencies Source: https://super-calendar.afonsojramos.me/guides/dom Commands to install the required packages using npm or pnpm. ```bash npm install @super-calendar/dom react react-dom @legendapp/list date-fns ``` ```bash pnpm add @super-calendar/dom react react-dom @legendapp/list date-fns ``` -------------------------------- ### Install package and peer dependencies Source: https://super-calendar.afonsojramos.me/quickstart Install the required dependencies for the calendar to function in a React Native environment. ```bash npx expo install @super-calendar/native react-native-reanimated react-native-gesture-handler react-native-worklets @legendapp/list date-fns ``` ```bash pnpm add @super-calendar/native react-native-reanimated react-native-gesture-handler react-native-worklets @legendapp/list date-fns ``` -------------------------------- ### Install web dependencies Source: https://super-calendar.afonsojramos.me/guides/web Install the required peer dependencies to enable React Native web support. ```bash npx expo install react-dom react-native-web @expo/metro-runtime ``` -------------------------------- ### Adding haptics on drag start Source: https://super-calendar.afonsojramos.me/guides/dragging Use the onDragStart callback to trigger haptic feedback when an event is initially picked up. ```tsx import * as Haptics from "expo-haptics"; { void Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium); }} />; ``` -------------------------------- ### Implementing a basic week grid in Super Calendar Source: https://super-calendar.afonsojramos.me/migrating-from-calendar-kit A minimal example showing the controlled component pattern using date state and event handlers. ```tsx import { useState } from "react"; import { Calendar, type CalendarEvent } from "@super-calendar/native"; export function Schedule({ events }: { events: CalendarEvent[] }) { const [date, setDate] = useState(() => new Date()); return ( console.log(event.title)} onDragEvent={(event, start, end) => console.log("moved", event.title, start, end)} /> ); } ``` -------------------------------- ### Configure a basic week view calendar Source: https://super-calendar.afonsojramos.me/guides/time-grid Initializes a calendar in week mode, starting the scroll position at 8:00 AM. ```tsx ``` -------------------------------- ### Implement a DateRangePicker Source: https://super-calendar.afonsojramos.me/guides/date-picker A controlled date range input that manages start and end selection. ```tsx import { useState } from "react"; import { type DateRange, DateRangePicker } from "@super-calendar/dom"; function Field() { const [range, setRange] = useState(null); return ; } ``` -------------------------------- ### Reschedule events in month mode Source: https://super-calendar.afonsojramos.me/guides/dragging Implement event rescheduling by using the onDragEvent prop to update event start and end times. ```tsx setEvents((prev) => prev.map((e) => (e.id === event.id ? { ...e, start, end } : e))) } /> ``` -------------------------------- ### Rejecting a drag event Source: https://super-calendar.afonsojramos.me/guides/dragging Return false from onDragEvent to prevent a drop. This example demonstrates using expo-haptics to provide feedback when a drop is rejected due to overlaps. ```tsx import * as Haptics from "expo-haptics"; onDragEvent={(event, start, end) => { if (overlapsAnother(event, start, end)) { void Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error); return false; } setEvents((prev) => prev.map((e) => (e.id === event.id ? { ...e, start, end } : e))); }} ``` -------------------------------- ### Basic Month View Implementation Source: https://super-calendar.afonsojramos.me/guides/month-view Standard configuration for rendering a month grid with date navigation. ```tsx { setDate(day); setMode("day"); }} /> ``` -------------------------------- ### Initialize Calendar Component Source: https://super-calendar.afonsojramos.me/guides/dom Basic implementation of the Calendar component using the week mode and event handling. ```tsx import { Calendar, type CalendarEvent } from "@super-calendar/dom"; const events: CalendarEvent[] = [ { title: "Standup", start: new Date(2026, 5, 23, 9, 0), end: new Date(2026, 5, 23, 9, 30) }, ]; export function App() { return ( console.log(event.title)} /> ); } ``` -------------------------------- ### Enable keyboard day navigation in month view Source: https://super-calendar.afonsojramos.me/guides/dom Adds roving day focus to a month view, allowing users to select days via keyboard. Requires the keyboardDayNavigation prop and an onPressDay handler. ```tsx import { Calendar, type CalendarEvent } from "@super-calendar/dom"; const events: CalendarEvent[] = [ { title: "Standup", start: new Date(2026, 5, 23, 9, 0), end: new Date(2026, 5, 23, 9, 30) }, ]; // Month view where arrow keys also move a roving day focus (Enter opens the day). console.log("open day", day)} />; ``` -------------------------------- ### Render a schedule view with Calendar Source: https://super-calendar.afonsojramos.me/guides/schedule Basic implementation of the schedule mode using the Calendar component. ```tsx ``` -------------------------------- ### Create events via drag Source: https://super-calendar.afonsojramos.me/guides/dragging Use the onCreateEvent prop to handle event creation by dragging on empty grid space. ```tsx setEvents((prev) => [...prev, { id: makeId(), title: "New event", start, end }]) } /> ``` -------------------------------- ### Porting Prompt for Coding Agents Source: https://super-calendar.afonsojramos.me/coming-from-react-big-calendar A set of instructions to provide to an AI coding agent for automating the migration from react-big-calendar to super-calendar. ```text You are porting a react-big-calendar app to super-calendar. On the web import from `@super-calendar/dom`; on React Native import from `@super-calendar/native` (add Reanimated v4, Gesture Handler, Worklets, @legendapp/list v3, date-fns and wrap the app in ). Rewrite the calendar element rather than renaming a localizer. 1. Drop the `localizer`. Pass `weekStartsOn` and, for non-English, a date-fns `Locale` as `locale`. Ensure event `start`/`end` are Date objects (not the accessor strings); fold startAccessor/endAccessor/titleAccessor into the event shape { start, end, title, ...yourFields }. 2. Replace `view`/`onView` with `mode`, and `date`/`onNavigate` with `date` + `onChangeDate`. Map views: month->"month", week->"week", day->"day", agenda->"schedule". 3. Handlers: onSelectEvent -> onPressEvent; onSelectSlot -> onCreateEvent (drag) and onPressCell/onPressDay (tap). 4. Drag/resize: remove the withDragAndDrop HOC and onEventDrop/onEventResize; add onDragEvent(event, start, end) (return false to reject). Set eventOverlap={false} to block overlaps declaratively. 5. Custom rendering: components.event -> a `renderEvent` component; components.toolbar -> your own controls or `headerComponent`; eventPropGetter/ dayPropGetter -> eventCellStyle/calendarCellStyle (and per-slot `classNames` on the web renderer). 6. Time-grid bounds min/max -> minHour/maxHour. 7. Recurrence: react-big-calendar has none; if you expanded rules yourself, use `expandRecurringEvents(events, rangeStart, rangeEnd)` over the visible range. 8. Note react-big-calendar treats the end date as exclusive; check all-day and multi-day spans render as you expect and adjust the end if needed. Then run the app and verify views, selection, event placement, and drag. ``` -------------------------------- ### Migration prompt for coding agents Source: https://super-calendar.afonsojramos.me/migrating-from-calendar-kit A comprehensive prompt designed for AI coding assistants to automate the migration process from @howljs/calendar-kit to @super-calendar/native. ```text You are migrating a React Native app from `@howljs/calendar-kit` to `@super-calendar/native`. They overlap on the time-grid views (day/3-day/week), resources, and drag, but the component shape is different, so rewrite the calendar layer rather than renaming props. Make the smallest changes that compile and preserve the current behaviour. 1. Dependencies - Remove `@howljs/calendar-kit`. - Add `@super-calendar/native` and its peers: `react-native-reanimated` (v4), `react-native-gesture-handler`, `react-native-worklets`, `@legendapp/list` (v3), and `date-fns`. On Expo use `npx expo install`. Keep `` at the app root. 2. Component shape - Replace the `CalendarContainer` / `CalendarHeader` / `CalendarBody` composition with a single ``. - calendar-kit is driven imperatively through a ref (`goToDate`, `goToNextPage`); super-calendar is controlled. Hold `date` in state, render ``, and change `date` / `mode` instead of calling ref methods. - Map the view: `numberOfDays={1|3|7}` becomes `mode="day" | "3days" | "week"`. There is no `CalendarBody` scroll config; the grid fills its parent, so wrap it in a `flex: 1` container. 3. Events - Pass the same event array to `events`. super-calendar reads `start`, `end`, and `title` (Dates, not ISO strings), plus any of your own fields via the generic `CalendarEvent`. Convert ISO strings to `Date`. - `onPressEvent` maps directly. `onLongPressEvent` maps directly. - Drag-to-edit (`onDragEventEnd`-style handlers) becomes a single `onDragEvent={(event, start, end) => ...}`; return `false` to reject a drop. - Drag-to-create (`onDragCreateEnd`) becomes `onCreateEvent={(start, end) => ...}`. - Tapping empty space maps to `onPressCell`. 4. Resources - The resource view moves to the `ResourceTimeline` component (import from `@super-calendar/native`). Pass `resources` and read each event's lane via `resourceId`. Its drag handler is `onDragEvent(event, start, end, resource)`. 5. Views calendar-kit doesn't have - Add `mode="month"` and `mode="schedule"` where useful; they come for free. 6. Theming - Move the `theme` object to super-calendar's `theme` prop (see the theming guide) and, on web, per-slot `classNames`. After migrating, run the app and check: the time grid renders, events land in the right slots, drag/resize/create still fire your handlers, and resources page as before. ``` -------------------------------- ### Implement dark mode with useColorScheme Source: https://super-calendar.afonsojramos.me/guides/theming Use the useColorScheme hook to toggle between the default and dark themes based on the system setting. ```tsx import { Calendar, darkTheme, defaultTheme } from "@super-calendar/native"; import { useColorScheme } from "react-native"; const scheme = useColorScheme(); ; ``` -------------------------------- ### Enabling Drag and Selection Source: https://super-calendar.afonsojramos.me/guides/month-view Configure drag-to-select and drag-to-move functionality for events and date ranges. ```tsx ``` -------------------------------- ### Create all-day events in month mode Source: https://super-calendar.afonsojramos.me/guides/dragging Enable all-day event creation in month mode by passing the onCreateEvent prop with the allDay flag. ```tsx setEvents((prev) => [...prev, { id: makeId(), title: "New", start, end, allDay: true }]) } /> ``` -------------------------------- ### Porting prompt for coding agents Source: https://super-calendar.afonsojramos.me/coming-from-fullcalendar Use this prompt to instruct a coding agent on how to migrate FullCalendar components, event handlers, and data structures to the super-calendar API. ```text You are porting a FullCalendar app to super-calendar. On the web import from `@super-calendar/dom`; on React Native import from `@super-calendar/native` and add its peers (Reanimated v4, Gesture Handler, Worklets, @legendapp/list v3, date-fns) with at the root. Rewrite the calendar rather than renaming plugins. 1. Replace the element with a single . Map views: dayGridMonth -> "month", timeGridWeek -> "week", timeGridDay -> "day", listWeek -> "schedule", multiMonthYear -> "year". Resource timeline becomes the separate component. 2. Hold the anchor date in state; replace datesSet/goto API calls with setting `date` and reading `onChangeDate` / `onChangeDateRange`. 3. Events: pass an array of { start: Date, end: Date, title, ...your fields }. Convert ISO strings to Date. For URL/Google/iCal feeds, fetch them yourself (use `parseICalendar` for iCal text). Keep your own event objects for saving. 4. Handlers: eventClick -> onPressEvent; dateClick/select -> onPressCell / onPressDay / onCreateEvent; editable -> onDragEvent(event, start, end); eventStartEditable / eventDurationEditable / eventOverlap keep their names; enforce eventConstraint/businessHours by returning false from onDragEvent. 5. Rendering: eventContent/eventDidMount -> a `renderEvent` component. 6. Recurrence: replace the rrule plugin with `expandRecurringEvents(events, rangeStart, rangeEnd)` over the visible range, or set `recurrence` on events. 7. There is no built-in header toolbar; render your own prev/next/title controls and drive `date` / `mode`. Then run the app and verify views, event placement, drag/resize, and recurrence. ``` -------------------------------- ### Implement TimeGrid and MonthList Source: https://super-calendar.afonsojramos.me/guides/dom Use TimeGrid and MonthList components with the useDateRange hook. Note that both components require an explicit height prop for virtualization. ```tsx import { useMemo } from "react"; import { type CalendarEvent, MonthList, TimeGrid, useDateRange } from "@super-calendar/dom"; const events: CalendarEvent[] = [ { title: "Standup", start: new Date(2026, 5, 23, 9, 0), end: new Date(2026, 5, 23, 9, 30) }, { title: "Design review", start: new Date(2026, 5, 23, 9, 15), end: new Date(2026, 5, 23, 10, 30), }, ]; export function App() { const today = useMemo(() => new Date(), []); const { range, onPressDate, reset } = useDateRange({ minDate: today }); return ( <> ); } ``` -------------------------------- ### Create a custom range picker Source: https://super-calendar.afonsojramos.me/guides/date-picker Build a custom picker interface by wrapping MonthList and using the useDateRange hook. ```tsx import { MonthList, useDateRange } from "@super-calendar/dom"; function CustomRange() { const { range, onPressDate } = useDateRange(); return ( ); } ``` -------------------------------- ### Enable keyboard event navigation in time grid Source: https://super-calendar.afonsojramos.me/guides/dom Enables arrow-key movement between events in a week view. Requires the keyboardEventNavigation prop. ```tsx import { Calendar } from "@super-calendar/dom"; // Time grid where arrow keys move a roving focus between events. ; ``` -------------------------------- ### Component Props Source: https://super-calendar.afonsojramos.me/reference/api The component is the primary entry point for the library. Below are the common props used to configure the calendar's data, date, and display settings. ```APIDOC ## Component Props ### Description The component is the main entry point for the library. It accepts various props to control event data, anchor dates, and display modes. ### Props - **events** (CalendarEvent[]) - The list of events to display. The generic T represents your custom data structure. - **date** (Date) - The controlled anchor date, read in the device's local time. - **mode** (CalendarMode) - The display mode of the calendar. Options: 'month', 'week', 'day', '3days', 'custom', 'schedule'. - **numberOfDays** (number) - The number of columns to display when mode is set to 'custom'. - **weekStartsOn** (0–6) - Defines the start of the week (0 = Sunday, 1 = Monday). - **weekdayFormat** ('narrow' | 'short' | 'long') - The width of the weekday header (default: 'short'). - **timeZone** (string) - The IANA time zone used to display events. ``` -------------------------------- ### Initialize Agenda Component Source: https://super-calendar.afonsojramos.me/guides/dom Implementation of the Agenda component for displaying a scrolling list of events grouped by date. ```tsx import { Agenda, type CalendarEvent } from "@super-calendar/dom"; const events: CalendarEvent[] = [ { title: "Standup", start: new Date(2026, 5, 23, 9, 0), end: new Date(2026, 5, 23, 9, 30) }, { title: "Lunch", start: new Date(2026, 5, 23, 12, 0), end: new Date(2026, 5, 23, 13, 0) }, ]; console.log(event.title)} onPressDay={(day) => console.log("header", day)} />; ``` -------------------------------- ### Implement Resource Paging Source: https://super-calendar.afonsojramos.me/guides/resource-timeline Use resourcesPerPage and resourcePage to control the number of visible lanes and navigate between pages. ```tsx const [page, setPage] = useState(0); const pages = Math.ceil(resources.length / 3); ; // Your controls: