Command palette

@yasinsensoy/native

React Native · Components

EventCalendar

Event calendar and scheduler: month, week, day, agenda and year views.

26 exports

Live example

The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.

Preview

All day

Change the recurring event?

New event

Code

import { CalendarEvent, EventCalendar } from "@yasinsensoy/native";

const [events, setEvents] = useState<CalendarEvent[]>([
  { id: 1, title: "Daily standup", start: "2026-11-02T09:30", end: "2026-11-02T09:45",
    recurrence: "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR", color: "chart-7" },
  { id: 2, title: "Tech fair", start: "2026-11-04", end: "2026-11-06", color: "chart-4" },
]);

<EventCalendar
  events={events}
  className="h-[80dvh]"
  businessHours={{ start: "09:00", end: "18:00" }}
  onEventChange={(d) => setEvents((l) => applyEventChange(l, d))}
  onEventDelete={(s) => setEvents((l) => applyEventDelete(l, s))}
  onEventCreate={(field) => formuAc(field)}
  onEventEdit={(t) => formuAc(t.event)}
/>

Events

  1. Events appear here when you interact with the preview.

Loading from the server range by range (onRangeChange + loading)

Sun
Mon
Tue
Wed
Thu
Fri
Sat

Change the recurring event?

Read-only agenda, custom row rendering

Change the recurring event?

Import

import {
  EventCalendar,
  defaultEventCalendarMessages,
  enEventCalendarMessages,
  describeRecurrence,
  parseRecurrence,
  formatRRule,
  getOccurrences,
  applyEventChange,
  applyEventDelete,
} from "@yasinsensoy/native";

EventCalendar

component

Event calendar and scheduler: month, week, day, agenda and year views. Same API and the same model as EventCalendar on web (recurrence rules, layout and changes are shared in core).

  • Editing: Long-press and drag an event; resize a timed box by its bottom edge and a multi-day bar by its right edge. A timed event dropped on the all-day row becomes all-day, and vice versa. A new event range is selected by long-pressing an empty slot and dragging. Everything snaps to 15 minutes; the grid scrolls by itself near the edges.
  • Recurring events: A subset of RFC 5545 RRULE. When an occurrence is changed, "This event / This and following / All" is asked.
  • Phone: The week drops to 3 days; swiping left/right moves to the previous/next range; details open in a bottom sheet. Looks the same on iOS and Android.
  • Screen reader: Events have "Move earlier / Move later / Move to previous day / Move to next day / Extend / Shorten / Delete" actions.
  • Times are wall-clock times ("2026-10-31T14:30"); no time zone conversion is done.
EventCalendar(props: EventCalendarProps<T>): JSX.Element

Examples

const [events, setEvents] = useState<CalendarEvent[]>([
  { id: 1, title: "Planning", start: "2026-11-02T10:00", end: "2026-11-02T11:00",
    recurrence: "FREQ=WEEKLY;BYDAY=MO", color: "chart-3" },
  { id: 2, title: "Trade fair", start: "2026-11-04", end: "2026-11-06" },
]);

<EventCalendar
  events={events}
  style={{ flex: 1 }}
  onEventChange={(d) => setEvents((l) => applyEventChange(l, d))}
  onEventDelete={(s) => setEvents((l) => applyEventDelete(l, s))}
  onEventCreate={(slot) => openForm(slot)}
/>

Default (Turkish) texts.

defaultEventCalendarMessages: EventCalendarMessages

English texts.

enEventCalendarMessages: EventCalendarMessages

Turns a recurrence rule into readable text: "Every week: Monday, Wednesday", "Every month, on the last Friday", "Every 2 days, 10 times". Use it in the detail card and your own forms.

describeRecurrence(rule: RecurrenceRule | string, locale?: string, messages?: Partial<EventCalendarMessages>): string

Examples

describeRecurrence("FREQ=WEEKLY;BYDAY=MO,WE", "en-US", enEventCalendarMessages) // "Every week: Monday, Wednesday"
describeRecurrence({ freq: "monthly", byWeekday: [{ day: 5, nth: -1 }] }) // "Her ay, ayın son Cuma"

Turns an RFC 5545 RRULE string into a RecurrenceRule object; undefined when not recognized. An "RRULE:" prefix is allowed. Supported fields: FREQ, INTERVAL, COUNT, UNTIL, BYDAY, BYMONTHDAY, BYMONTH.

parseRecurrence(value: RecurrenceRule | string | null | undefined): RecurrenceRule | undefined

Examples

parseRecurrence("FREQ=MONTHLY;BYDAY=-1FR")
// { freq: "monthly", byWeekday: [{ day: 5, nth: -1 }] }

formatRRule

function

Turns a RecurrenceRule object into an RFC 5545 RRULE string (without the "RRULE:" prefix). To write calendar files (.ics) or store it in one database field.

formatRRule(rule: RecurrenceRule): string

Examples

formatRRule({ freq: "weekly", byWeekday: [1, 3] }) // "FREQ=WEEKLY;BYDAY=MO,WE"

Occurrences of the events (recurrences expanded) between the given days. For your own lists, notifications or exports.

getOccurrences(events: readonly T[], from: DateInput, to: DateInput): EventOccurrence<T>[]

Examples

getOccurrences(events, "2026-11-01", "2026-11-30").length

Applies an EventChange to the event list and returns the new list (does not mutate the input). For recurring events, by scope:

  • "this": the occurrence is excluded from the series (exclude) and a new one-off event is added in its place.
  • "following": the series ends before this occurrence (until/count) and a new series starts from it.
  • "all": the whole series shifts by the same amount (weekly days shift too).
applyEventChange(events: readonly T[], change: EventChange<T>, options?: ApplyChangeOptions<T>): T[]

Examples

<EventCalendar events={events}
  onEventChange={(change) => setEvents((list) => applyEventChange(list, change))} />

Applies an EventDeletion: a non-recurring event is deleted; for a recurring one, by scope the occurrence is excluded ("this"), the series ends before it ("following") or the whole series is deleted ("all").

applyEventDelete(events: readonly T[], deletion: EventDeletion<T>): T[]

Examples

onEventDelete={(deletion) => setEvents((list) => applyEventDelete(list, deletion))}

Values passed to the function that renders the detail window's content.

NameTypeDescription
occurrenceEventOccurrence<T>The tapped occurrence (for a recurring event, that day's occurrence).
close() => voidCloses the window.

Props of the EventCalendar component (same names as on web).

NameTypeDefaultDescription
eventsreadonly T[]Events. Recurring ones (recurrence) are expanded for the visible range; even with thousands of events only the visible range is computed.
view?EventCalendarViewView in controlled use.
defaultView?EventCalendarView"week"Initial view in uncontrolled use.
onViewChange?(view: EventCalendarView) => voidCalled when the view changes.
views?readonly EventCalendarView[]["month", "week", "day", "agenda"]Views offered in the view switcher (in order). With a single view the switcher is hidden.
date?DateInputDay shown in controlled use ("2026-10-31" or a Date).
defaultDate?DateInputtodayInitial day in uncontrolled use.
onDateChange?(date: string) => voidCalled with the ISO day when the shown day changes.
onRangeChange?(range: EventCalendarRange) => voidCalled when the visible range changes (also on the first render). For loading events from the server range by range.
onEventClick?(occurrence: EventOccurrence<T>) => voidCalled when an event is tapped (also when the detail window opens).
onEventChange?(change: EventChange<T>) => voidCalled when an event is long-pressed and dragged, or resized from its bottom edge (its right edge for a bar). When given, events become editable. For a recurring event "This event / This and following / All" is asked first. Use applyEventChange to update the list.
onEventCreate?(slot: EventSlot) => voidCalled when an empty slot is tapped or a range is selected by long-pressing and dragging. When given, slots become selectable; usually a form is opened.
onEventDelete?(deletion: EventDeletion<T>) => voidThe "Delete" button in the detail window and the screen reader's "Delete" action. Can be applied with applyEventDelete.
onEventEdit?(occurrence: EventOccurrence<T>) => voidThe "Edit" button in the detail window. If omitted the button is not shown.
eventDetails?boolean | ((event: T, context: EventDetailsContext<T>) => ReactNode)trueDetail window that opens on tap (a bottom sheet on a phone). false turns it off; with a function you render its body.
renderEvent?(event: T, info: EventRenderInfo) => ReactNodeTo render the inside of an event box yourself.
editable?booleantrue` if `onEventChange` is givenWhether dragging and resizing are enabled. Can be turned off per event with editable: false.
selectable?booleantrue` if `onEventCreate` is givenWhether empty slot selection is enabled.
weekStartsOn?0 | 1 | 2 | 3 | 4 | 5 | 6First day of the week. Defaults to the language (tr-TR is Monday).
minTime?string"00:00"First hour of the time grid.
maxTime?string"24:00"Last hour of the time grid ("24:00" is the end of the day).
slotDuration?number30Interval of the thin lines in the grid (minutes).
snapDuration?number15Interval snapped to while dragging (minutes).
hourHeight?number56Height of one hour (dp; scales with the screen). Larger than on web (48) so dragging with a finger is comfortable.
scrollToTime?stringHour to scroll to when the week/day view opens ("08:00"). If omitted, one hour before now when today is visible, otherwise 08:00.
businessHours?BusinessHoursBusiness hours; hours outside are dimmed.
narrowDays?number3Number of days in the week view on narrow widths (below 640 dp, i.e. a phone); navigated by swiping left/right.
agendaDays?number30Number of days shown per page in the agenda.
showWeekNumbers?booleanfalseShow ISO week numbers?
dimPastEvents?booleantrueDim past events?
defaultDuration?number60Duration of a timed event without a duration (minutes).
loading?booleanShows a thin loading bar on top (e.g. while a range loads).
toolbar?booleantrueToolbar (today, previous/next, title, view switcher).
toolbarEnd?ReactNodeElements to add at the end of the toolbar (e.g. a "New event" button). On narrow screens they are on the view switcher's row.
messages?Partial<EventCalendarMessages>Texts. If omitted, Turkish or English defaults depending on the language; give only the ones you want to change. See EventCalendarMessages.
locale?stringLanguage of the date and time formats. Defaults to the UIProvider language.
label?stringmessages.labelScreen reader name.
style?StyleProp<ViewStyle>Root style. The height comes from here (or from the container's flex).
testID?stringTest id.

Calendar views.

type EventCalendarView = "month" | "week" | "day" | "agenda" | "year"

Day of the week: 0 Sunday, 1 Monday … 6 Saturday.

type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6

BusinessHours

interface

Business hours: hours outside are shown faded.

NameTypeDefaultDescription
days?readonly number[][1, 2, 3, 4, 5]Working days of the week (0 Sunday … 6 Saturday).
startstringStart ("09:00").
endstringEnd ("18:00").

Texts of EventCalendar. Pass only the ones you want to change with messages; the rest are the Turkish defaults. Placeholders such as {count} are replaced with values.

NameTypeDefaultDescription
labelstring"Etkinlik takvimi"Screen reader name of the calendar.
todaystring"Bugün"
previousstring"Önceki"
nextstring"Sonraki"
monthstring"Ay"View names.
weekstring"Hafta"
daystring"Gün"
agendastring"Ajanda"
yearstring"Yıl"
daysstring"{count} gün"Name of the week view on narrow screens.
viewstring"Görünüm"Screen reader name of the view picker.
goToDatestring"Tarihe git"Go to date button.
allDaystring"Tüm gün"
morestring"+{count} daha"Events that do not fit.
showLessstring"Daralt"Collapses the all-day row.
noEventsstring"Bu aralıkta etkinlik yok"When the agenda has no events.
newEventstring"Yeni etkinlik"Name of the new event created while dragging.
untitledstring"(Başlıksız)"Untitled event.
editstring"Düzenle"
deletestring"Sil"
closestring"Kapat"
confirmstring"Tamam"
cancelstring"İptal"
recurringChangestring"Tekrarlayan etkinlik değiştirilsin mi?"Question asked when changing a recurring event.
recurringDeletestring"Tekrarlayan etkinlik silinsin mi?"
scopeThisstring"Bu etkinlik"
scopeFollowingstring"Bu ve sonraki etkinlikler"
scopeAllstring"Tüm etkinlikler"
weekNumberstring"{week}. hafta"Week number.
keyboardHintstring"Taşımak için Alt ve ok tuşları, süreyi değiştirmek için Alt, Shift ve yukarı/aşağı ok"Keyboard hint (screen reader).
touchHintstring"Taşımak için basılı tutup sürükleyin"Touch hint (screen reader, React Native).
moveEarlierstring"Erkene al"Accessibility action: move 15 minutes (the snap interval) earlier.
moveLaterstring"İleriye al"
movePreviousDaystring"Önceki güne taşı"
moveNextDaystring"Sonraki güne taşı"
lengthenstring"Uzat"
shortenstring"Kısalt"
dailystring"Her gün"Recurrence texts.
everyDaysstring"{count} günde bir"
weeklystring"Her hafta"
everyWeeksstring"{count} haftada bir"
monthlystring"Her ay"
everyMonthsstring"{count} ayda bir"
yearlystring"Her yıl"
everyYearsstring"{count} yılda bir"
onMonthDaystring"ayın {day}. günü"
onLastMonthDaystring"ayın son günü"
onNthWeekdaystring"ayın {nth}. {weekday}"
onLastWeekdaystring"ayın son {weekday}"
untilstring"{date} tarihine kadar"
timesstring"{count} kez"

NthWeekday

interface

Which weekday of the month or year: { day: 2, nth: 1 } is the first Tuesday of the month, { day: 5, nth: -1 } the last Friday.

NameTypeDescription
dayWeekdayDay of the week (0 Sunday … 6 Saturday).
nthnumberWhich one: 1 first, 2 second … ; -1 last, -2 second to last.

Visible date range (both ends included, "YYYY-MM-DD").

NameTypeDescription
startstringFirst day.
endstringLast day.

A recurrence rule. A commonly used subset of the RFC 5545 (iCalendar) RRULE; the same rule can be given as text too ("FREQ=WEEKLY;BYDAY=MO,WE"). See parseRecurrence.

NameTypeDefaultDescription
freq"daily" | "weekly" | "monthly" | "yearly"Frequency.
interval?number1Every how many units (2 → every two weeks).
count?numberTotal number of occurrences (the first included). Not given together with until.
until?DateInputLatest day of the last occurrence (inclusive).
byWeekday?readonly (Weekday | NthWeekday)[]Days of the week. Which days in weekly; with nth in monthly/yearly, like "the first Monday of the month"; a filter in daily.
byMonthDay?readonly number[]Days of the month (1–31; -1 is the last day of the month).
byMonth?readonly number[]Months (1 January … 12 December).

Examples

{ freq: "daily" }                                   // every day
{ freq: "weekly", byWeekday: [1, 3, 5] }            // Monday, Wednesday, Friday
{ freq: "weekly", interval: 2, count: 6 }           // every two weeks, 6 times
{ freq: "monthly", byWeekday: [{ day: 5, nth: -1 }] } // last Friday of every month
{ freq: "monthly", byMonthDay: [15] }               // the 15th of every month
{ freq: "yearly", until: "2030-12-31" }             // same day every year, until the end of 2030

CalendarEvent

interface

An event shown in the calendar. You may add your own fields; every callback returns the event as the object you gave.

Times are wall clock times (no time zone): "2026-10-31T14:30", "2026-10-31" for all-day, or a Date (local time).

NameTypeDefaultDescription
idstring | numberUnique id.
titlestringTitle.
startDateInputStart: "2026-10-31T09:00", "2026-10-31" for all-day, or a Date. Text without a time makes the event all-day automatically.
end?DateInputEnd. For timed events the end instant (exclusive); for all-day events the last day (inclusive): end: "2026-11-04" for November 2–4. When omitted, a timed event lasts 1 hour and an all-day event one day.
allDay?booleanAll-day event? When omitted, whether start has a time decides.
color?string"chart-1"Color: any CSS color ("#e11d48", "oklch(…)") or a theme name: "chart-1" … "chart-8", "primary", "success", "warning", "danger".
description?stringDescription shown in the detail card.
location?stringLocation.
recurrence?RecurrenceRule | stringRecurrence rule (object or RRULE string). See RecurrenceRule.
exclude?readonly DateInput[]Days excluded from the recurrence (deleted or separately edited occurrences).
editable?booleanWhen false, this event cannot be dragged or resized.

Which occurrences of a recurring event change.

type RecurringScope = "this" | "following" | "all"

EventChange

interface

Result of a drag or resize. Apply it to the event list with applyEventChange.

NameTypeDescription
eventTThe changed event (the object you gave).
startstringNew start: "YYYY-MM-DDTHH:mm" when timed, "YYYY-MM-DD" when all-day.
endstringNew end: the end instant when timed, the last day (inclusive) when all-day.
allDaybooleanIs the new state all-day? (Changes when dragged onto the all-day row.)
kind"move" | "resize"Kind of change.
recurringbooleanIs the event recurring?
scopeRecurringScopeScope the user picked for a recurring event; always "all" for a non-recurring one.
occurrenceStartstringOriginal start of the changed occurrence (same format).

EventDeletion

interface

An event to delete. Apply it with applyEventDelete.

NameTypeDescription
eventTThe deleted event.
recurringbooleanIs the event recurring?
scopeRecurringScopePicked scope for a recurring event; "all" otherwise.
occurrenceStartstringStart of the deleted occurrence.

EventSlot

interface

A time range selected by dragging or clicking on empty space.

NameTypeDescription
startstringStart: "YYYY-MM-DDTHH:mm" when timed, "YYYY-MM-DD" when all-day.
endstringEnd: the end instant when timed, the last day (inclusive) when all-day.
allDaybooleanSelected from the all-day row or the month view?

A single occurrence of an event within a range (each repeat of a recurring event is separate). Returned by getOccurrences.

NameTypeDescription
keystringUnique key: "id:YYYY-MM-DD" for recurring ones.
eventTThe event itself.
startstringStart ("YYYY-MM-DDTHH:mm" when timed, "YYYY-MM-DD" when all-day).
endstringEnd (the end instant when timed, the last day inclusive when all-day).
allDaybooleanAll-day?
recurringbooleanAn occurrence of a recurring event?

Options: id of the new event in operations that split an occurrence off. "<id>-<YYYY-MM-DD>" when omitted.

NameTypeDescription
createId?(event: T, occurrenceStart: string) => string | numberBuilds an id for a split occurrence or a new series.

Information passed to the EventCalendarProps.renderEvent function.

NameTypeDescription
viewEventCalendarViewWhich view it is drawn in.
variant"timed" | "bar" | "dot" | "agenda"Shape of the box: "timed" a box in the time grid, "bar" an all-day or multi-day bar, "dot" a timed row in the month view, "agenda" an agenda row.
timestringFormatted time range ("09:00 – 10:30"); empty for all-day.
draggingbooleanWhether it is being dragged.