Introducing a new way to review your PRs.

Read the announcement

frappe / frappe-ui

The all-in-one toolkit for modern frontends. High-quality components, app recipes and AI-ready docs.

View on GitHub

28 documents · Updated Nov 23, 2026

docs / experimental-calendar

Experimental calendar

The experimental calendar is a schedule surface for viewing and managing events in day, week, month, or agenda views. It turns one event feed into time-grid entries, all-day bars, and event rows while keeping navigation, range loading, and edit actions tied to the same date state. It is available from frappe-ui/experimental, alongside the rich text editor, list view, and theme switcher modules.

Calendar surface

The experimental/…/Calendar.vue component is the calendar surface and the shared owner of the active date, active view, configuration, event state, and public callbacks. It passes the data needed by the selected view and provides common actions to event components.

The public contract accepts an events feed and optional CalendarConfig values. It also supports custom headers, event popover content, agenda row content, click handlers, and create, update, delete, and rangeChange events. The parent application remains the source of truth for saved events.

View selection

The view selector offers Day, Week, Month, and Agenda modes. The default header shows the current date context, a month picker, previous and next controls, Today, and the enabled modes. A custom header slot receives the same navigation actions and state.

The calendar keeps a useful date anchor when the mode changes. A week title can cover two months or two years. An agenda title names its three-month window. Consumers can set the initial mode and disable modes through CalendarConfig.

References: experimental/…/Calendar.vue• L75-130 experimental/…/Calendar.vue• L200-214 experimental/…/Calendar.vue• L432-447 experimental/…/types.ts• L4-5 experimental/…/types.ts• L111-153

Visible range

The calendar reports the range that the current view needs through rangeChange. Day view reports one day. Week view reports its seven dates. Month view reports the complete month strip with its padding days. Agenda view reports its three-month span with whole-week padding.

This range is the contract for a data source that loads events on demand. A source that fetches only the named month or only the unpadded agenda months can miss events that the view lists or draws at its edges.

References: experimental/…/Calendar.vue• L769-830 experimental/…/agendaDays.ts• L39-77 experimental/…/monthStrip.ts• L33-38 experimental/…/types.ts• L163-179 experimental/…/Calendar.api.md• L76-96

Scheduling views

The views use one event feed but answer different scheduling questions. Day and Week views emphasize time placement. Month view emphasizes date coverage. Agenda view emphasizes the next events and gives each event more room for context.

Day view

Day view gives one date a 24-hour time grid and an all-day area. Timed events appear at their start and end times. The current-time marker shows the live position in the day. The grid opens near the configured starting hour.

The all-day area can collapse when event labels do not fit on one line. An empty time cell supplies a date and a time to the new-event action. An empty all-day cell supplies the date without a time. Both actions require edit mode unless a consumer provides onCellClick.

References: experimental/…/CalendarDaily.vue• L22-125 experimental/…/CalendarDaily.vue• L127-192 experimental/…/CalendarDaily.vue• L222-242 experimental/…/useHourGrid.ts• L5-18 experimental/…/CalendarTimeMarker.vue• L1-13

Week view

Week view places seven dates above seven time columns. Full-day and multi-day events share an all-day row. Shorter timed events appear in the matching day columns. Selecting a date in the header opens that date in Day view.

The all-day row packs spanning bars into lanes. If more than three lanes are needed, the row shows two lanes and a per-day count for hidden bars until the user expands it. The layout is measured from the available calendar width so narrow columns use a denser treatment. In a narrow week, day names and dates stack in the header and event lanes become shorter.

Empty all-day and time cells still pass clicks to the new-event action, but they keep the default cursor because the whole cell is not presented as a separate control. Event controls keep their own interaction affordance.

References: experimental/…/CalendarWeekly.vue• L34-73 experimental/…/CalendarWeekly.vue• L83-191 experimental/…/CalendarWeekly.vue• L212-265 experimental/…/CalendarWeekly.vue• L332-395 experimental/…/CalendarWeekly.spec.ts• L45-77

Month view

Month view is a scrollable strip of Sunday-to-Saturday week rows. Each row gives spanning events a bar area above the day cells. Single-day events appear below the bars. Wide rows grow to show their content instead of hiding it behind a count.

On narrow screens the calendar keeps the month grid but uses shorter event rows and tighter lanes. It shows a +n count when a cell cannot fit every event. The row can also reduce its spanning-bar lanes so every day still has room for its count. Selecting a date number opens that date in Day view.

References: experimental/…/CalendarMonthly.vue• L21-43 experimental/…/CalendarMonthly.vue• L49-172 experimental/…/CalendarMonthly.vue• L253-420 experimental/…/Calendar.cy.ts• L143-227

Agenda view

Agenda view presents three calendar months as a list of weeks and days. It omits empty days and empty weeks, so the available space describes only dates with events. Each event is a row with room for time, a description, status tags, and participant information.

The window starts at the first day of the anchor month and ends at the last day of the third month. Its data range is padded to whole weeks. When the anchor is the current month, the list scrolls to the first listed day on or after today. Earlier days remain in the range and can be reached by scrolling.

Agenda rows derive a time label, a multi-day position such as Day 2/3, an ended state, and Now or Soon timing. Consumers can add application-specific content through event-description, event-suffix, and event-participant slots. The list changes to a stacked layout below 640px of its own width, not only below the browser width.

References: experimental/…/CalendarAgenda.vue• L29-52 experimental/…/CalendarAgenda.vue• L401-545 experimental/…/CalendarAgenda.vue• L564-617 experimental/…/agendaDays.ts• L7-18 experimental/…/eventRow.ts• L22-81 experimental/…/eventRow.ts• L121-168 experimental/…/CalendarEventRow.vue• L241-327

Event model

An event describes a title and an inclusive date range. It can also carry times and schedule data such as participant, venue, type, color, full-day status, draft status, or declined status. The calendar accepts this same business event in every view and derives view-only placement data around it.

Date coverage

The event occupies every date from fromDate through toDate. A full-day event ignores its times. A timed event that lasts at least one day becomes an all-day-like event for the week, month, and agenda layouts.

A shorter timed event that crosses midnight stays in the time grid. The calendar cuts it into one visible piece per occupied day. The first piece ends at midnight and the next starts at midnight. A timed event that ends at 00:00 does not occupy that ending date.

References: experimental/…/types.ts• L20-51 experimental/…/eventSpan.ts• L115-158 experimental/…/eventSpan.ts• L161-190 experimental/…/eventSpan.spec.ts• L54-175

Event layout

Spanning events stay in one lane across every day they cover in a row. The visible bar is clipped to the row and records whether the event starts or ends inside that row. Squared ends show that a bar continues into the previous or next row.

Timed entries use overlap columns within a day. Placement considers the painted height of an event, so a short event that is padded for readability can still overlap the next event visually. Declined events remain visible with muted, struck-through titles but do not reserve a column. Draft events use a dashed outline. Event colors and legacy color values resolve to theme-aware event colors.

References: experimental/…/eventSpan.ts• L193-267 experimental/…/calendarUtils.ts• L126-237 experimental/…/CalendarMonthEvent.vue• L14-64 experimental/…/CalendarWeekDayEvent.vue• L46-79 experimental/…/useEventBase.ts• L26-93

Data flow

The calendar keeps a working copy of the input events so local create, move, resize, and delete actions can update the visible schedule before the parent persists them. It normalizes date and time fields at the calendar boundary, then emits changes so the parent can update its own source of truth.

The following flow shows how one event feed becomes view data and how user changes return to the application.

flowchart LR
    P[events prop] --> S[calendar working state]
    S --> D[calendar data composable]
    D --> T[timed day segments]
    D --> A[all-day and spanning events]
    T --> G[Day and Week time grids]
    A --> W[Week all-day lanes]
    A --> M[Month bars and cells]
    S --> Q[Agenda rows]
    G --> I[interaction actions]
    W --> I
    M --> I
    Q --> I
    I --> E[create, update, delete emits]
    E --> P

Event partitions

The useCalendarData composable separates events into timed entries and all-day-like entries. It creates clipped day segments for overnight events, adds time positions for the grid, groups entries by date, and assigns overlap columns. Views consume these groups without changing the event’s business meaning.

Placement fields belong only to the view. Before an update leaves the calendar, the calendar removes segment fields so saved events do not depend on the view that produced them.

References: experimental/…/useCalendarData.ts• L8-42 experimental/…/eventSpan.ts• L161-190 experimental/…/eventSpan.ts• L324-330 experimental/…/Calendar.vue• L315-349 experimental/…/Calendar.vue• L371-382

Event persistence

Create, update, and delete actions change the working copy and emit the corresponding event or event ID. The parent application must persist the emitted change and keep its events prop current. A later prop change reloads the working copy.

The public action boundary also supports explicit date navigation, event reload, and visible-range reporting. This keeps local calendar behavior separate from remote data loading and persistence.

References: experimental/…/Calendar.vue• L188-195 experimental/…/Calendar.vue• L347-389 experimental/…/Calendar.vue• L812-846 experimental/…/index.ts• L1-19

Strip navigation

The Month view uses a dated strip of week rows instead of a fixed-height page. monthStrip defines the Sunday-to-Saturday rows for a month and includes the neighboring dates needed to complete the first and last weeks.

useStripScroll keeps the strip aligned with date navigation. It can scroll to the selected date or an explicit jump date. It also preserves the row at the top when event data changes row heights and reports the top date for consumers that need scroll context. Agenda uses the same dated-row idea for its week and day navigation.

The arrows, Today button, month picker, date numbers, and transitions between views all use the calendar’s shared date state. This prevents a title, selected day, and visible rows from drifting apart.

References: experimental/…/monthStrip.ts• L14-38 experimental/…/useStripScroll.ts• L12-21 experimental/…/useStripScroll.ts• L42-128 experimental/…/CalendarMonthly.vue• L455-465 experimental/…/Calendar.vue• L519-767

Interaction model

The calendar separates event inspection from event editing. A single event click opens detail content. A double click opens editing when enabled. An empty cell starts a new event when edit mode is enabled. Each default event or cell action can be replaced by a callback.

The following sequence shows the shared event and cell interaction path.

sequenceDiagram
    participant U as User
    participant C as Calendar
    participant P as Popover or modal
    participant A as Application

    U->>C: Click event
    C->>P: Open detail popover
    U->>C: Double-click event
    C->>P: Open edit modal when edit mode is on
    U->>C: Click empty cell
    C->>P: Open new-event modal when edit mode is on
    P->>C: Save or delete
    C->>A: Emit create, update, or delete
    A->>C: Refresh events prop

Event actions

CalendarEventPopover gives every event presentation the same inspection and edit boundary. The default content shows event details and edit or delete controls when edit mode is enabled. The event-popover-content slot can replace that content and receives the event, the represented date, edit-mode state, and a close action.

Single-click handling waits briefly so a double click can take the edit path. A consumer onClick callback takes over the click without opening the default popover. The delete shortcut is armed only after the popover opens and is removed when it closes or unmounts.

References: experimental/…/CalendarEventPopover.vue• L1-49 experimental/…/useEventBase.ts• L96-167 experimental/…/useEventBase.ts• L179-215 experimental/…/Calendar.api.md• L48-73

Event movement

Edit mode supports moving timed events by day or minute, resizing their end time, and moving month-view events by whole days. A move keeps the event duration and shifts both date endpoints together. A time move can cross midnight and therefore change the dates the event occupies.

Month-view dragging records the date under the pointer when the drag starts. It applies the difference between that date and the drop date, so grabbing the middle of a spanning event moves the whole stay by the intended number of days.

References: experimental/…/CalendarWeekDayEvent.vue• L788-935 experimental/…/CalendarMonthly.vue• L467-523 experimental/…/eventSpan.ts• L274-321

Keyboard shortcuts

When enabled, m, w, a, and d select a view. t returns to today. The left and right arrow keys move through the active view. Delete or Backspace removes the event whose popover is open when edit mode and shortcuts are enabled.

Shortcuts stop while an input is focused or while a dialog, popover, menu, or listbox is open. This keeps an overlay or editor in control of the keyboard instead of changing the calendar behind it.

References: experimental/…/Calendar.vue• L260-304 experimental/…/useEventBase.ts• L96-124 experimental/…/types.ts• L121-137 experimental/…/Calendar.md• L151-158

Change checklist

When these files or sections are changed, remember to consider these:

  • Changes to the event date contract must be checked against eventDays, daySegments, month bars, all-day lanes, agenda rows, and the rangeChange boundary. Midnight end times are especially easy to change by accident.
  • Changes to placement fields must preserve cleanup before update emits. Saved events must not depend on a view-only segment, overlap column, or lane.
  • Changes to agenda window rules must keep its title, listed rows, rangeChange payload, empty state, and scroll anchor in agreement.
  • Changes to month row height or dated row markers must be checked with useStripScroll; row anchoring and date jumps depend on the data-strip-date contract.
  • Changes to event click timing must preserve the separation between single-click popovers, double-click editing, keyboard activation, and drag or resize gestures.
  • Changes to weekly cell markup or styling must preserve click-to-create behavior while keeping empty cells on the default cursor. The visible affordance belongs to the event controls and hidden-event buttons.
  • Changes to CalendarConfig defaults or CalendarMode values must be checked against all four views, the header slot, keyboard shortcuts, and range reporting.

Important failure modes

TriggerConsequenceGuard
A data source fetches only the named calendar monthMonth cells at the start or end of the strip can show no event data for neighboring datesUse the rangeChange start and end dates, which include strip padding
A data source treats the agenda title months as the full fetch rangeEvents in the padded week rows can be missing from the first or last agenda weekFetch the agenda rangeChange span rather than only the three named months
A timed event ends at midnight and is treated as occupying the ending dateThe event appears one day too long in the all-day row, month strip, or agendaApply the inclusive date rule with the midnight exception in eventDays
A view emits a segment or lane field as the saved eventLater renders can receive stale placement data or persist fields that describe only one viewRemove placement fields before the update event
A parent ignores create, update, or delete emitsThe calendar can show a local change until the next prop reload, then return to old source dataPersist the emitted change and refresh the events prop
A custom event click callback suppresses the popover but still arms the delete shortcutDelete or Backspace can remove an event even though no event popover is openArm the shortcut only after the default popover opens and remove it on close or unmount
A global shortcut runs while a dialog, popover, menu, listbox, or input is activeThe calendar changes view or date behind the active controlKeep overlay and editable-target checks around global shortcuts
A spanning drag uses the drop date as the new event startGrabbing the middle of a stay changes its duration or shifts it by the wrong number of daysStore the grab date and shift both endpoints by the date difference
Empty weekly cells are styled as pointer controls without changing their action modelThe grid suggests that each empty cell is a separate control even though the click action belongs to the cell areaKeep the default cursor on empty cells and preserve the cell click handler

Key files

FileWhy to read it
experimental/…/Calendar.vueMain public surface, shared date state, view selection, event lifecycle, and range reporting
experimental/…/types.tsEvent, configuration, callback, slot, and emitted range contracts
experimental/…/CalendarDaily.vueOne-day time grid and all-day behavior
experimental/…/CalendarWeekly.vueSeven-day time grid, responsive day headers, all-day lanes, and weekly cell interaction behavior
experimental/…/CalendarWeekly.spec.tsWeekly grid contract for empty-cell cursor behavior and click-to-create handling
experimental/…/CalendarMonthly.vueMonth strip, spanning bars, narrow-cell capacity, and drag movement
experimental/…/CalendarAgenda.vueThree-month agenda layout, responsive rows, loading state, and list navigation
experimental/…/CalendarEventRow.vueAgenda event content and consumer row slots
experimental/…/eventSpan.tsShared date coverage, overnight classification, row lanes, and event movement
experimental/…/eventRow.tsAgenda time labels, day-span labels, past state, and timing tags
experimental/…/agendaDays.tsAgenda window, populated days, and week grouping
experimental/…/monthStrip.tsMonth week boundaries and padded strip range
experimental/…/useCalendarData.tsConversion from source events into timed and all-day view data
experimental/…/useHourGrid.tsShared hour labels, click-to-time behavior, and initial scroll
experimental/…/useStripScroll.tsDate-row scrolling and scroll-position preservation
experimental/…/useEventBase.tsShared event click, edit, delete, color, and shortcut behavior
experimental/…/CalendarEventPopover.vueCommon event inspection and custom popover boundary
experimental/…/index.tsExperimental package exports and public calendar types