Event Calendar

Pro

Month, week and day views of a schedule. Drag an event to another slot, pull an edge to change its length, or do both from the keyboard.

1 AM2 AM3 AM4 AM5 AM6 AM7 AM8 AM9 AM10 AM11 AM12 PM1 PM2 PM3 PM4 PM5 PM6 PM7 PM8 PM9 PM10 PM11 PM

Try it yourself. This one is live, and its code is right below.

1 AM2 AM3 AM4 AM5 AM6 AM7 AM8 AM9 AM10 AM11 AM12 PM1 PM2 PM3 PM4 PM5 PM6 PM7 PM8 PM9 PM10 PM11 PM

Installation#

# One-time setup (tokens + lib helpers)npx koalaui-cli@latest init# Activate your Pro license (once per machine)npx koalaui-cli@latest login <key># Add this component (its dependencies come along)npx koalaui-cli@latest add event-calendar

Usage#

This example is part of Koala UI Pro

The preview is yours to explore. Its code comes with a Pro license, paid once and used in every project.

Have a license? Unlock it here

Anatomy#

import {  EventCalendar,  EventCalendarHeader,  EventCalendarTitle,  EventCalendarNav,  EventCalendarAddButton,  EventCalendarViewSwitch,  EventCalendarBody,  EventCalendarEditor,} from "@/components/ui/event-calendar"<EventCalendar>  <EventCalendarHeader>    <EventCalendarTitle />    <EventCalendarNav />    <EventCalendarAddButton />    <EventCalendarViewSwitch />  </EventCalendarHeader>  <EventCalendarBody />  <EventCalendarEditor /></EventCalendar>

Drag, resize and keys#

In the week and day grid, drag an event to another time or day, or pull its top or bottom edge to change its length, in steps of snapMinutes. Events that overlap sit side by side. The event in hand lifts and glides from step to step, a dashed outline marks where it came from, the events around it stay put, and the grid scrolls when you reach its edge. Escape puts it back. A press without movement is still a click. Nothing changes until you let go: then onEventChange gets the updated event, and you write it back into events. With an event focused, the arrow keys do the same: up and down move it by snapMinutes, left and right by a day, and Shift with up or down changes its length.

Create, edit and delete#

Double-click empty space, press and drag across it to sweep out the length (across days in the month grid and the all-day row, starting anywhere in a day but on an event), press N, or use the add button. With onEventCreate set, the editor opens on a draft that already sits in the grid and changes as you type. Click an event to edit it; Enter saves, Escape cancels, and Delete or Backspace on a focused event removes it through onEventDelete. On a phone the editor is a bottom sheet: one setting per row, label left and value right, and a single full-width Save in reach of the thumb. Closing it keeps what you typed, as clicking away does on a wide calendar; an end earlier than the start runs to the next day.

Smart fill#

The calendar places things for you. A double click lands a defaultDuration event, where you click. When the next event is in the way it slides up to finish as that one starts, and a gap shorter than that length is filled whole when it is at least half of it. The add button finds the first free gap, from now on today, and rolls over to the next morning when the day is full. A moved or resized event that only grazes a neighbour, by up to half its length or 30 minutes, slides flush against it; a deliberate overlap stays. Hold Shift while moving a block over a gap and it fits the gap under the pointer: it starts as the one before ends and, when it is longer than the gap, shrinks to end as the next begins. Hold it while pulling an edge and the edge reaches the nearest neighbour, so the event grows until it touches it. Shift and Alt take effect the moment you press them, mid-drag. Hold Alt while dragging to place freely, or turn it off with smartFill={false}. Try it here: double-click at 14:30 and the hour slides up to end as sprint planning starts, drag a block into a neighbour, or press the add button.

Wednesday, November 11 2026

1 AM2 AM3 AM4 AM5 AM6 AM7 AM8 AM9 AM10 AM11 AM12 PM1 PM2 PM3 PM4 PM5 PM6 PM7 PM8 PM9 PM10 PM11 PM10:20 AM
Standup, 9:30 AM
Customer call: Northwatt12:00 – 12:45 PM
Sprint planning3:00 – 4:30 PM

Mobile#

Under 560px of its own width the calendar is built for a thumb. A finger on the grid scrolls, so on touch a long press takes hold: on empty space it creates an event there, on an event it lifts it to drag, with a short vibration where the phone has one. A sideways swipe pages to the next or previous day, week or month. The add button floats bottom right, every free day in the agenda is a row to tap, the day title shortens to one line, and the editor is a bottom sheet. A deleted event can be brought back for five seconds on every size, from the undo bar, which takes focus, or with Ctrl+Z or ⌘Z.

Wednesday, November 11 2026

1 AM2 AM3 AM4 AM5 AM6 AM7 AM8 AM9 AM10 AM11 AM12 PM1 PM2 PM3 PM4 PM5 PM6 PM7 PM8 PM9 PM10 PM11 PM10:20 AM
Standup, 9:30 AM
Customer call: Northwatt12:00 – 12:45 PM
Sprint planning3:00 – 4:30 PM

Month#

Timed events show as a dot, a time and a title, and drop the time once a cell is narrower than 120px so the title keeps the room; all-day events show as a tinted bar, listed first. A day with more than maxEventsPerDay ends in "+N more", which opens that day. Drag an event to another cell, or move it with the arrow keys: a day sideways, a week up or down. Click a day number to open that day.

Selection#

selectedDate fills the picked day's cell and selectedEventId lifts the picked event; both are yours to set, usually from onSlotClick and onEventClick. Pick one or the other: an event picked over a filled day reads as two selections, so clear selectedDate when an event is picked. Selected reads in ink, never the brand colour, and hover is only a hint of it. now pins today and the now-line to one moment, for screenshots, tests and demos that should look the same every day.

November 2026

Mon
Tue
Wed
Thu
Fri
Sat
Sun
44
45
Public holiday
46
Standup9:30 AM
Roadmap review11:00 AM
Lunch with Kira1:00 PM
Standup9:30 AM
Design critique10:00 AM
Standup9:30 AM
Customer call: Northwatt12:00 PM
Sprint planning3:00 PM
Standup9:30 AM
1:1 with Sam11:00 AM
Release v4.24:00 PM
Standup9:30 AM
Demo day2:00 PM
Team drinks6:00 PM
47
Offsite in Lisbon
Dentist8:30 AM
48
Launch week
Quarterly review10:00 AM
49

Day#

One column fits a sidebar or a phone. Pass a single entry to views and the view switch goes away. Under 560px of its own width the calendar turns phone-shaped by itself: week becomes a day strip over an agenda, month a dotted grid over the picked day, and day keeps its time grid under the strip, where a swipe scrolls instead of dragging.

1 AM2 AM3 AM4 AM5 AM6 AM7 AM8 AM9 AM10 AM11 AM12 PM1 PM2 PM3 PM4 PM5 PM6 PM7 PM8 PM9 PM10 PM11 PM

Read only#

editable={false} turns off dragging and the keys; events still open through onEventClick. The header is made of parts: this one leaves out the view switch. startHour, endHour and hourHeight fit a working day into a shorter card.

9 AM10 AM11 AM12 PM1 PM2 PM3 PM4 PM5 PM6 PM7 PM

Click an event to open it.

Event sizes#

A block shows as much as its length allows. Up to 30 minutes the title and start time share one line. From 45 minutes the time range drops under the title, and from about 75 minutes the title wraps onto more lines before it truncates.

November 2026

9 AM10 AM11 AM12 PM
Team sync, 9:00 AM
Team sync, 9:00 AM
Team sync9:00 – 9:45 AM
Quarterly planning with Globex9:00 – 10:00 AM
Quarterly planning with Globex9:00 – 10:30 AM
Quarterly planning with Globex9:00 – 11:00 AM
Quarterly planning with Globex9:00 AM – 12:00 PM

Colours#

color tints the block and its bar with one of the theme's roles, so events stay readable in all three themes. Without it, an event uses neutral.

9 AM10 AM11 AM12 PM1 PM2 PM3 PM4 PM5 PM

API reference#

EventCalendar

The card holding the schedule, 680px tall (an h-* class sets another height). With no children it renders EventCalendarHeader and EventCalendarBody. Forwards all native <div> props, and every part accepts className, merged last.

PropTypeDefaultDescription
events*CalendarEvent[]-{ id, title, start, end, allDay?, color? }. An all-day event's end is its last day, inclusive.
onEventChange(event: CalendarEvent) => void-Called with the updated event when a drag, a resize or a key moves it. Write it back into events.
onEventClick(event: CalendarEvent) => void-Called on a click, or Enter on a focused event. Never after a drag.
onSlotClick(slot: CalendarSlot) => void-For your own create flow, when onEventCreate is not set. Called when empty space is double-clicked (a defaultDuration slot fitted to its gap, or a whole day in the month grid), swept by pressing and dragging, or long-pressed on touch.
onEventCreate(event: CalendarEvent) => void-Turns on the built-in editor. A double click, a sweep, a long press or the add button opens it on a draft; Save hands you the new event to add to events. Without it, those gestures go to onSlotClick.
onEventDelete(event: CalendarEvent) => void-Shows Delete in the editor, and lets Delete or Backspace remove a focused event.
defaultDurationnumber60Minutes a new event lasts when you create it with a double click or the add button, before it is fitted to its gap.
defaultColorEventColor"neutral"The colour a new event starts with.
smartFillbooleantrueFits new and moved events into the gaps around them. Hold Alt while dragging to place one freely.
labelsPartial<EventCalendarLabels>-Every string the editor and the add button show, for translation.
view"month" | "week" | "day"-The view on show. Controlled.
defaultView"month" | "week" | "day""week"The view it opens on. Uncontrolled.
onViewChange(view) => void-Called when the switch, a day heading or "+N more" changes the view.
dateDate-Any day inside the period on show. Controlled.
defaultDateDatetodayThe day it opens on. Uncontrolled; without it, the calendar opens on now, or the browser's today.
onDateChange(date: Date) => void-Called when the reader navigates.
viewsEventCalendarView[]["month", "week", "day"]The views the switch offers. One view hides the switch.
weekStartsOn0–61The first day of the week, 0 for Sunday.
localestringthe browser'sBCP 47 locale for every label.
nowDatethe browser's clockPins today, the now-line and the Today button to this moment. Without it they follow the clock, read only after hydration.
selectedDateDate-Marks a day as selected: a faint fill on its month cell and its heading. Set it from onSlotClick or onDateChange.
selectedEventIdstring | null-Lifts the event with this id: a deeper tint, a rise and a shadow. Set it from onEventClick.
editablebooleantrueEvents can be dragged, resized and moved with the keyboard.
snapMinutesnumber15Drags, resizes and keys move in steps of this many minutes.
hourHeightnumber48The height of one hour in the time grid, in px.
startHournumber0The first hour the time grid shows.
endHournumber24The hour the time grid ends at.
scrollToHournumber8The hour the time grid opens scrolled to.
maxEventsPerDaynumber3Most rows a month cell fills before the last one becomes "+N more". Fewer when the row is short, so nothing is cut.
agendaEmptyLabelstring"No events"What a day without events says in the agenda a narrow calendar shows.
Data attributeDescription
data-viewmonth, week or day.
data-selectedOn the month cell, the day number and the event that selectedDate and selectedEventId pick.
data-narrowPresent under 560px of its own width: week becomes a day strip over an agenda, month a dotted grid over the picked day's agenda, day keeps its time grid under the strip.

EventCalendarHeader

The bar above the grid. With no children: title, navigation, the add button and the view switch. Forwards all native <div> props.

EventCalendarAddButton

A primary icon button that creates an event in the first free gap of the day in view (from now on today, from scrollToHour otherwise) and opens the editor on it. Renders nothing when the calendar cannot create. With floating it is a round button over the bottom right of the body, which the calendar shows by itself under 560px, in reach of the thumb. Forwards Button props.

EventCalendarEditor

Create, edit and delete in place. On a wide calendar a popover pinned beside the event, which changes live as you type; under 560px a bottom sheet with one setting per row and a full-width Save. Enter saves and Escape cancels. Clicking away or closing the sheet keeps what you typed, and an untitled new event is dropped. Focus returns to the event. Part of the default children; renders when onEventCreate is set.

EventCalendarPopover

Your own content in a popover pinned beside an event: to the right in week and day, under it in month. It follows the event while it moves, stays open when you click the same event again, and gives focus back to the event when it closes. Forwards PopoverContent props.

PropTypeDefaultDescription
eventIdstring | null-The event to pin to. null closes the popover.
onOpenChange(open: boolean) => void-Called with false on Escape or a click outside.

EventCalendarTitle

An <h2> naming the period, the year in the muted ink, announced politely when it changes. Forwards all native <h2> props.

EventCalendarNav

Today, previous and next: an outline Button and two ghost icon buttons. Forwards all native <div> props.

PropTypeDefaultDescription
todayLabelstring"Today"The label of the button that returns to today.

EventCalendarViewSwitch

A segmented ToggleGroup over the root's views; renders nothing with one view. Forwards ToggleGroup props.

PropTypeDefaultDescription
labelsPartial<Record<EventCalendarView, string>>-The label of each view.

EventCalendarBody

The grid for the current view. A new period fades and rises in once the reader navigates, never on load. Forwards all native <div> props.

FAQ#

No. It works on plain Date objects in the browser's time zone and formats every label with Intl, so it adds nothing to your bundle. Bring date-fns or Temporal for your own logic if you want; the calendar only reads start and end.