# Event Details

The panel and popover for viewing and editing an event.

Live example, interactive at https://calendarcn.xyz/docs/components/event-details. Its source:

```tsx title="src/examples/event-details-demo.tsx"
"use client";

import * as React from "react";
import { format } from "date-fns";

import {
  CalendarProvider,
  useCalendarConfig,
} from "@/components/calendar-provider";
import { EventDetailPanel } from "@/components/event-detail-panel";
import type {
  DetailedCalendarEvent,
  EventReminder,
} from "@/components/calendar-types";
import { DEMO_CONFERENCE_PROVIDERS } from "@/lib/conference-providers";
import {
  DEMO_CALENDARS,
  DEMO_CONTACTS,
  DEMO_LOCATION_SUGGESTIONS,
  DEMO_ROOMS,
} from "@/lib/mock-events";
import { formatRecurrenceRule, getEventRecurrenceRule } from "@/lib/recurrence";

/**
 * A fixed event, built from local date parts so the server and the browser
 * render the same times
 */
const INITIAL_EVENT: DetailedCalendarEvent = {
  id: "design-review",
  title: "Design review",
  start: new Date(2026, 10, 4, 14, 0),
  end: new Date(2026, 10, 4, 15, 30),
  calendarId: "Work",
  calendarEmail: "you@work.example.com",
  location: "Room 4B",
  description: "Walk through the new onboarding flow.",
  // Every week on Wednesday
  recurrenceRule: { frequency: "weekly", weekdays: [3] },
  reminders: [{ amount: 10, unit: "minutes" }],
  status: "busy",
  visibility: "default",
};

/** "10 minutes", "1 day at 9:00" */
function formatReminder({ amount, unit, time }: EventReminder): string {
  const units = amount === 1 ? unit.slice(0, -1) : unit;
  if (!time) return `${amount} ${units}`;
  const minutes = String(time.minutes).padStart(2, "0");
  return `${amount} ${units} at ${time.hours}:${minutes}`;
}

/** The values joined, or nothing for an empty list */
function joinList(values: string[] | undefined): string | undefined {
  return values?.length ? values.join(", ") : undefined;
}

/** Every field the panel edits, as the event holds it */
function EventState({ event }: { event: DetailedCalendarEvent }) {
  const { locale } = useCalendarConfig();
  const rule = getEventRecurrenceRule(event);

  const fields: [string, string | undefined][] = [
    ["title", event.title],
    ["kind", event.kind],
    ["start", format(event.start, "EEE MMM d, p", { locale })],
    ["end", format(event.end, "EEE MMM d, p", { locale })],
    ["isAllDay", String(Boolean(event.isAllDay))],
    ["timeZone", event.timeZone],
    [
      "recurrenceRule",
      rule ? formatRecurrenceRule(rule, event.start, locale) : undefined,
    ],
    [
      "participants",
      joinList(
        event.participants?.map((p) =>
          [
            p.name ?? p.email,
            p.organizer && "(organizer)",
            p.optional && "(optional)",
          ]
            .filter(Boolean)
            .join(" "),
        ),
      ),
    ],
    ["rooms", joinList(event.rooms?.map((room) => room.name))],
    ["conference", event.conference?.url],
    ["aiMeetingNotes", String(Boolean(event.aiMeetingNotes))],
    ["location", event.location],
    ["links", joinList(event.links?.map((link) => link.url))],
    ["attachments", joinList(event.attachments?.map((file) => file.name))],
    ["description", event.description],
    ["calendarId", event.calendarId],
    ["color", event.color],
    ["status", event.status],
    ["visibility", event.visibility],
    ["reminders", joinList(event.reminders?.map(formatReminder))],
  ];

  return (
    <dl className="grid w-[320px] shrink-0 grid-cols-[auto_1fr] gap-x-3 gap-y-1 rounded-lg bg-background p-3 text-xs shadow-xs ring-1 ring-black/5 @xl:w-72 dark:shadow-none dark:ring-white/10">
      {fields.map(([name, value]) => (
        <React.Fragment key={name}>
          <dt className="font-mono text-muted-foreground">{name}</dt>
          <dd
            className={
              value === undefined
                ? "text-muted-foreground"
                : "line-clamp-2 break-words tabular-nums"
            }
          >
            {value ?? "—"}
          </dd>
        </React.Fragment>
      ))}
    </dl>
  );
}

export function EventDetailsDemo() {
  const [event, setEvent] = React.useState(INITIAL_EVENT);

  return (
    // The provider supplies what the panel offers to pick from: calendars,
    // contacts, rooms, video call services and places, here the live demo's
    // (@calendarcn/sample-data and @calendarcn/conference-providers). Without
    // one, those sections have nothing to offer, and the rest still work.
    <CalendarProvider
      calendars={DEMO_CALENDARS}
      contacts={DEMO_CONTACTS}
      rooms={DEMO_ROOMS}
      conferenceProviders={DEMO_CONFERENCE_PROVIDERS}
      locationSuggestions={DEMO_LOCATION_SUGGESTIONS}
    >
      {/* Side by side when the container is wide enough, stacked otherwise */}
      <div className="@container h-full overflow-y-auto bg-muted/40">
        <div className="flex flex-col items-center gap-4 p-6 @xl:flex-row @xl:items-start @xl:justify-center">
          <div className="w-[320px] shrink-0 overflow-hidden rounded-lg bg-popover shadow-sm ring-1 ring-black/5 dark:shadow-none dark:ring-white/10">
            <EventDetailPanel event={event} onEventChange={setEvent} />
          </div>
          <EventState event={event} />
        </div>
      </div>
    </CalendarProvider>
  );
}
```

`EventDetailPanel` shows an event's details and edits them in place. The views open it in a popover beside the selected event, and you can render it yourself anywhere, such as a side panel. It needs an event, and `onEventChange` to edit it: without a change handler the panel is read-only. Inside a `CalendarProvider` it uses the provider's clock and locale, and its `calendars`, `contacts`, `rooms`, `conferenceProviders` and `locationSuggestions`. On its own it uses the defaults: no calendars to pick, contacts, rooms, conferencing services or place suggestions. The preview passes the live demo's, from [Sample Data](/docs/sample-data) and the [conference providers](#conference-providers).

## Installation

```bash
npx shadcn add @calendarcn/event-details
```

Or install it by hand:

1. Install the items it builds on: `@calendarcn/calendar-core`
2. Install the dependencies: `npm install @floating-ui/react-dom date-fns lucide-react react-day-picker@^9`
3. Add the shadcn/ui components it uses: `npx shadcn add avatar button calendar command dialog dropdown-menu popover switch`
4. Copy these files into your project, keeping the paths under your components, hooks and lib folders:
   - [`components/calendar-event-item.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/calendar-event-item.tsx)
   - [`components/event-detail-panel.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-panel.tsx)
   - [`components/event-detail-parts.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-parts.tsx)
   - [`components/event-detail-time.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-time.tsx)
   - [`components/event-detail-time-field.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-time-field.tsx)
   - [`components/event-detail-date-field.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-date-field.tsx)
   - [`components/event-detail-field-popover.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-field-popover.tsx)
   - [`components/event-detail-timezone.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-timezone.tsx)
   - [`components/event-detail-recurrence.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-recurrence.tsx)
   - [`components/event-detail-participants.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-participants.tsx)
   - [`components/event-detail-conferencing.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-conferencing.tsx)
   - [`components/event-detail-ai-notes.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-ai-notes.tsx)
   - [`components/event-detail-location.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-location.tsx)
   - [`components/event-detail-suggestions.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-suggestions.tsx)
   - [`components/event-detail-links.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-links.tsx)
   - [`components/event-detail-description.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-description.tsx)
   - [`components/event-detail-calendar.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-calendar.tsx)
   - [`components/event-detail-availability.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-availability.tsx)
   - [`components/event-detail-reminders.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-reminders.tsx)
   - [`components/event-detail-popover.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-detail-popover.tsx)
   - [`components/event-context-menu.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-context-menu.tsx)
   - [`components/event-draft.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-draft.tsx)
   - [`components/event-series-scope-dialog.tsx`](https://github.com/vmnog/calendarcn/blob/main/src/components/event-series-scope-dialog.tsx)
   - [`hooks/use-popover-dismiss.ts`](https://github.com/vmnog/calendarcn/blob/main/src/hooks/use-popover-dismiss.ts)
   - [`hooks/use-inline-edit.ts`](https://github.com/vmnog/calendarcn/blob/main/src/hooks/use-inline-edit.ts)
   - [`hooks/use-hover-tooltip.ts`](https://github.com/vmnog/calendarcn/blob/main/src/hooks/use-hover-tooltip.ts)
   - [`hooks/use-field-popover.ts`](https://github.com/vmnog/calendarcn/blob/main/src/hooks/use-field-popover.ts)
   - [`lib/time-input.ts`](https://github.com/vmnog/calendarcn/blob/main/src/lib/time-input.ts)

## Usage

```tsx
import { EventDetailPanel } from "@/components/event-detail-panel";

export function EventSidebar() {
  const [event, setEvent] = React.useState(initialEvent);

  return <EventDetailPanel event={event} onEventChange={setEvent} />;
}
```

To show the selected event of a calendar in a side panel, read it from `useCalendar()` and turn the popover off on the view. Pass `onTitlePreview` while the selected event is the [draft](/docs/components/calendar-core#creating-events), so typing its title previews it and the first edit saves it:

```tsx
function SidePanel() {
  const { selectedEvent, eventDraft, editEvent, updateEventDraft } =
    useCalendar<DetailedCalendarEvent>();
  if (!selectedEvent) return null;

  return (
    <EventDetailPanel
      event={selectedEvent}
      onEventChange={editEvent}
      onTitlePreview={
        eventDraft?.id === selectedEvent.id ? updateEventDraft : undefined
      }
    />
  );
}

<CalendarProvider defaultEvents={events}>
  <WeekView showEventPopover={false} />
  <SidePanel />
</CalendarProvider>;
```

`editEvent` changes the event like the views' popover does: on a date of a repeating event, it holds the change until the event is left, then asks which events it applies to.

Leave out `onEventChange` to show an event read-only, for example one from a calendar people can only view. The title and the other fields don't accept typing and the menus that change the event are disabled, so no edit looks saved when it isn't.

```tsx
<EventDetailPanel event={event} />
```

The "..." menu cuts, copies, duplicates and deletes the event through `onCut`, `onCopy`, `onDuplicate` and `onDelete`; an action you don't pass is disabled. The views' popover passes the provider's. For a panel you render yourself, pass `useCalendar()`'s:

```tsx
const { cutEvent, copyEvent, duplicateEvent, deleteEvent } =
  useCalendar<DetailedCalendarEvent>();

<EventDetailPanel
  event={selectedEvent}
  onEventChange={editEvent}
  onCut={() => cutEvent(selectedEvent.id)}
  onCopy={() => copyEvent(selectedEvent.id)}
  onDuplicate={() => duplicateEvent(selectedEvent.id)}
  onDelete={() => deleteEvent(selectedEvent.id)}
/>;
```

The repeat row's arrows step through a series. In the views' popover they work on their own: the provider finds the selected event's neighbors (`previousInSeries` and `nextInSeries` from `useCalendar()`, `null` at the series' ends) and `showSeriesOccurrence` selects one and moves to it. Occurrences your events don't hold are generated from the rule, so stepping to one selects it without adding anything; its first edit stores it, through `onEventCreate`. Pass the same to a panel you render yourself:

```tsx
const { previousInSeries, nextInSeries, showSeriesOccurrence } =
  useCalendar<DetailedCalendarEvent>();

<EventDetailPanel
  event={selectedEvent}
  onEventChange={editEvent}
  onPrevWeek={
    previousInSeries ? () => showSeriesOccurrence(previousInSeries) : undefined
  }
  onNextWeek={
    nextInSeries ? () => showSeriesOccurrence(nextInSeries) : undefined
  }
/>;
```

Outside a provider, `findSeriesOccurrence(events, event, "next")` (from `@/lib/recurrence`) finds the occurrence: `{ id, start, event }`, with the event stored for that date or the one generated for it. A series is a repeating event plus the events that name it with `seriesId`; `excludedDates` are skipped. A `recurrenceRule` counts its days in the event's `timeZone`, so a 9 AM New York series stays at 9 AM there across daylight saving changes. Events whose `recurrence` is display text step between the events with the same title, calendar and text.

## Conference providers

The Conferencing row adds a video call from the services in the provider's `conferenceProviders`. Nothing is on by default: with no services the row is hidden, unless the event already has a call. To offer the live demo's Google Meet, Zoom and Microsoft Teams, install them and pass them in:

```bash
npx shadcn add @calendarcn/conference-providers
```

Or install it by hand:

1. Install the items it builds on: `@calendarcn/calendar-core`
2. Copy these files into your project, keeping the paths under your components, hooks and lib folders:
   - [`lib/conference-providers.ts`](https://github.com/vmnog/calendarcn/blob/main/src/lib/conference-providers.ts)

```tsx
import { DEMO_CONFERENCE_PROVIDERS } from "@/lib/conference-providers";

<CalendarProvider conferenceProviders={DEMO_CONFERENCE_PROVIDERS}>
  <WeekView />
</CalendarProvider>;
```

`Calendar` takes the same prop.

They're placeholders. Each `createConference` makes up a call in the service's code format (`abc-defg-hij` for Meet) on `example.com`, after 400ms so the row's pending state shows, and no link opens a real meeting. Before people rely on them, make `createConference` create the meeting through the service's API and return its link. The API needs your credentials, so call it from your server:

```tsx
import type { ConferenceProviderOption } from "@/components/calendar-types";

const conferenceProviders: ConferenceProviderOption[] = [
  {
    provider: "zoom",
    label: "Zoom",
    icon: <ZoomLogo />,
    createConference: async (event) => {
      // Your route creates the meeting with Zoom's API
      const response = await fetch("/api/zoom-meetings", {
        method: "POST",
        body: JSON.stringify({ title: event.title, start: event.start }),
      });
      if (!response.ok) throw new Error("Zoom didn't create the meeting");
      const meeting = await response.json();
      return { provider: "zoom", url: meeting.joinUrl, meetingId: meeting.id };
    },
  },
];
```

A rejected promise adds no call. Labels must be unique, so you can offer one service twice, like two Zoom accounts.

### Logos

Google Meet, Zoom and Microsoft Teams logos are their owners' trademarks, so the item ships none and the row shows a camera for each service. To look like the live demo, give each option your own logo as its `icon`, taken from the service's brand resources and used under its terms. The icon shows at 16px in the menu and on the event. The demo does it this way:

```tsx
import type { ConferenceProvider } from "@/components/calendar-types";
import { DEMO_CONFERENCE_PROVIDERS } from "@/lib/conference-providers";

// Your own logo components or images
import { GoogleMeetLogo, TeamsLogo, ZoomLogo } from "@/components/logos";

const LOGOS: Partial<Record<ConferenceProvider, React.ReactNode>> = {
  "google-meet": <GoogleMeetLogo />,
  zoom: <ZoomLogo />,
  "microsoft-teams": <TeamsLogo />,
};

const conferenceProviders = DEMO_CONFERENCE_PROVIDERS.map((option) => ({
  ...option,
  icon: LOGOS[option.provider],
}));
```

An image file works too: `icon: <img src="/logos/zoom.svg" alt="" className="size-4" />`. An event's call shows the icon of the option that created it (the one with its `label`), or of the first option of its `provider`, so the demo's events that already have a Meet call show your Meet logo too.

## Features

- Edit the title in place. With `onEventChange` wired to the calendar, the event updates as you type.
- Pick the start and end times from a menu in 15-minute steps. End times show how long the event lasts (`1h 30min`).
- Type a time and the menu lists what it can mean, daytime first: `7` gives 7 PM, then 7 AM. In the end field a number is also a duration: `45` gives 45 minutes later.
- Hovering a time previews it. `Enter`, a click, or leaving the field after typing or arrow keys saves it. `Esc` restores the old value.
- Pick dates from a date picker, or type one (`Nov 12`). From the input, `↑` and `↓` move a day, and `Page Up` and `Page Down` a month.
- Switch an event to all-day and back: it gets its own times back, or 9–10 AM when it had none.
- Time options follow the wall clock, so they stay right on the days daylight saving time starts and ends.
- In every menu and list of the details, `Esc` closes it and restores the value from before it opened. Arrow keys and the pointer only preview: the time zone list shows the highlighted city in the field until `Enter` or a click picks it.
- Pick the event's time zone from a searchable list of every zone, with recent and popular ones first. The times keep their wall-clock value in the new zone, so the event moves on the grid, which (like the panel's times) stays in the calendar's zone, the viewer's unless the provider sets `timeZone`: 2 PM in New York becomes 2 PM in Tokyo, which is 1 AM New York time.
- When the calendar draws in another zone than the event's (the provider's [`timeZone`](/docs/components/calendar-core#time-zone), or while travelling), the times read on the calendar's clock and the time zone row shows the calendar's zone, as in Notion Calendar. "Switch to event's time zone to edit" shows the times on the event's own clock and lets you change its zone; "Switch to your primary time zone" goes back.
- Set a repeat rule from Notion's presets or the custom dialog (every N days, weeks, months or years, on chosen days, on the 1st to 4th or last weekday of the month, until a date or N times). `.ics` import and export keep it as an RRULE; an RRULE the details can't show reads "Custom repeat".
- Change or delete one date of a repeating event and the calendar asks which events it applies to, as Notion Calendar does. Changes made in the details wait, marked with a dot, until you leave the event. See [Editing a repeating event](/docs/components/calendar-core#editing-a-repeating-event).
- Fields the event doesn't set (participants, AI meeting notes, location, links, description, reminders) show Notion's muted placeholders. So does conferencing when the provider passes `conferenceProviders`; without them the row is hidden, unless the event already has a call.
- Invite participants. Focusing the field lists the provider's recent `contacts`; typing filters them and offers a typed email address. The calendar's account (`calendarEmail`) joins as the organizer with the first guest, and stays while anyone is invited. Each guest shows their response (accepted, declined or maybe) and "Organizer" or "Optional"; hover a guest to copy their email, email them, mark them optional or remove them. `Esc` closes the list and never invites anyone.
- Book meeting rooms from the provider's `rooms`, under "View rooms and resources" or by typing a room's name.
- Add a video call from one of the provider's `conferenceProviders`. While an async `createConference` runs, the row shows the service as pending; then it shows the service's icon, name (a link that joins the call) and meeting code, with buttons to copy the link and to switch service or remove the call.
- Type a location: the typed text is listed first, then the matching `locationSuggestions`. A location that's a web address opens itself. Any other location links to a Google Maps search, so clicking it sends the location text to Google.
- Turn AI meeting notes on or off. This only sets the event's `aiMeetingNotes` flag: the panel doesn't record or write notes.
- Add a link from "Add links and attachments": paste or type an address and press `Enter`. A bare domain like `example.com` gets `https://`, and text that isn't a link is dropped. Hover a link, or `Tab` onto it, to see its address with a copy button.
- Attach a file from the same menu. The panel keeps its name, size and type with a `blob:` URL; nothing is uploaded.
- Edit the description in place: the event takes the text when you leave it, and `Esc` restores it. Web addresses in it become links, and are also listed after the event's links.
- Move the event to another of the provider's `calendars` (grouped by account) or give it its own color, set it busy or free and pick who can see it, from menus that open beside the panel. Hovering a choice previews it; `Esc` closes the menu and keeps the old value.
- Add reminders from presets, or type a number to get it in minutes, hours, days or weeks ("2h", "10 mins"), up to 4 weeks before. Reminders stay sorted, and one that fires with another ("60min" and "1hour") isn't added twice. Adding one closes the list, and typing opens it again. Hover a reminder to remove it.
- Right-click an event on the calendar to change its color or calendar, or to cut, copy, duplicate or delete it. The details' "..." menu has the same four actions, each with its key: see [Keyboard shortcuts](/docs/keyboard-shortcuts).

## Custom details

Live example, interactive at https://calendarcn.xyz/docs/components/event-details. Its source:

```tsx title="src/examples/custom-event-details-demo.tsx"
"use client";

import * as React from "react";
import { format } from "date-fns";
import { XIcon } from "lucide-react";

import { cn } from "@/lib/utils";
import {
  CalendarProvider,
  useCalendar,
  useCalendarConfig,
} from "@/components/calendar-provider";
import { WeekView } from "@/components/week-view";
import { Button } from "@/components/ui/button";
import type {
  DetailedCalendarEvent,
  EventColor,
  EventDetailsRenderProps,
} from "@/components/calendar-types";
import { createSampleEvents } from "@/lib/sample-events";

/** Colors offered by the details popover, in display order */
const COLORS: EventColor[] = [
  "red",
  "orange",
  "yellow",
  "green",
  "blue",
  "purple",
  "gray",
];

/** Swatch class per event color, from the `--event-*-border` theme tokens */
const SWATCH_CLASS: Record<EventColor, string> = {
  red: "bg-event-red-border",
  orange: "bg-event-orange-border",
  yellow: "bg-event-yellow-border",
  green: "bg-event-green-border",
  blue: "bg-event-blue-border",
  purple: "bg-event-purple-border",
  gray: "bg-event-gray-border",
};

export function CustomEventDetailsDemo() {
  // The provider reads its initial events once, so create them once
  const [initialEvents] = React.useState(() => createSampleEvents(new Date()));

  return (
    <CalendarProvider
      defaultEvents={initialEvents}
      renderEventDetails={renderEventDetails}
    >
      <WeekView scrollToHour={8} />
    </CalendarProvider>
  );
}

/** Replaces the body of the popover that opens beside a selected event */
function renderEventDetails(
  props: EventDetailsRenderProps<DetailedCalendarEvent>,
) {
  return <EventDetails {...props} />;
}

/**
 * The popover body. A component rather than inline JSX, so it can use hooks:
 * `useCalendar()` to save edits, `useCalendarConfig()` to format times the
 * way the calendar does.
 */
function EventDetails({
  event,
  close,
  isNew,
}: EventDetailsRenderProps<DetailedCalendarEvent>) {
  // `editEvent` changes events the way the built-in details do: a date of
  // a repeating event waits until it is left, then asks once
  const { editEvent } = useCalendar<DetailedCalendarEvent>();
  const { hourCycle, locale } = useCalendarConfig();
  const timeFormat = hourCycle === 24 ? "HH:mm" : "h:mm a";

  return (
    <div className="flex flex-col gap-3 p-3">
      <div className="flex items-center gap-2">
        <input
          aria-label="Title"
          value={event.title}
          // A new event opens with its title ready to type
          autoFocus={isNew}
          onFocus={(e) => e.currentTarget.select()}
          onChange={(e) => editEvent({ ...event, title: e.target.value })}
          className="min-w-0 flex-1 rounded-sm bg-transparent px-1 py-0.5 text-sm font-semibold transition-colors duration-150 ease-out outline-none hover:bg-accent focus:bg-accent"
        />
        <Button
          variant="ghost"
          size="icon-sm"
          aria-label="Close"
          className="size-7"
          onClick={close}
        >
          <XIcon />
        </Button>
      </div>
      <p className="px-1 text-xs text-muted-foreground tabular-nums">
        {event.isAllDay
          ? `${format(event.start, "EEEE, MMM d", { locale })} · All day`
          : `${format(event.start, `EEEE, MMM d · ${timeFormat}`, { locale })} – ${format(event.end, timeFormat, { locale })}`}
      </p>
      <div
        role="radiogroup"
        aria-label="Color"
        className="flex items-center gap-1.5 px-1"
      >
        {COLORS.map((color) => (
          <button
            key={color}
            type="button"
            role="radio"
            aria-checked={(event.color ?? "blue") === color}
            aria-label={color}
            onClick={() => editEvent({ ...event, color })}
            className={cn(
              "size-5 rounded-full ring-offset-2 ring-offset-popover transition-[box-shadow,scale] duration-150 ease-out outline-none focus-visible:ring-2 focus-visible:ring-ring active:scale-[0.96] motion-reduce:active:scale-100",
              SWATCH_CLASS[color],
              (event.color ?? "blue") === color && "ring-2 ring-foreground/60",
            )}
          />
        ))}
      </div>
    </div>
  );
}
```

Pass `renderEventDetails` to `CalendarProvider` to replace the popover's body. It gets the selected event, a `close` function and `isNew`, which is true right after the event was created, so you can focus its title. A new event is a draft until its first edit: `updateEvent()` from `useCalendar()` saves it, and `updateEventDraft()` previews a change without saving. See [Creating events](/docs/components/calendar-core#creating-events). Render a component from it when you need hooks: `useCalendar()` to save edits, `useCalendarConfig()` to format times like the calendar does.

Change events with `editEvent` from `useCalendar()` rather than `updateEvent`: on a date of a repeating event it holds each change until the event is left, then asks once, as the built-in details do. The example above does that for the title and the color.

## Build your own panel

`EventDetailPanel` is one component per section, and they install with it. Render the ones you need, in your own order, to build a smaller panel or a different layout. Each section takes `EventDetailSectionProps`: the `event`, and `onEventChange`, without which the section is read-only.

```tsx
import type { EventDetailSectionProps } from "@/components/calendar-types";
import { EventDetailParticipants } from "@/components/event-detail-participants";
import {
  EventDetailDivider,
  EventDetailGroup,
} from "@/components/event-detail-parts";
import { EventDetailTime } from "@/components/event-detail-time";

export function CompactDetails({
  event,
  onEventChange,
}: EventDetailSectionProps) {
  return (
    <div className="flex flex-col text-sm font-medium">
      <EventDetailGroup name="when">
        <EventDetailTime event={event} onEventChange={onEventChange} />
      </EventDetailGroup>
      <EventDetailDivider />
      <EventDetailGroup name="who">
        <EventDetailParticipants event={event} onEventChange={onEventChange} />
      </EventDetailGroup>
    </div>
  );
}
```

| Import from                              | Exports                                                                                                                             | What it is                                                                                                                                                                                         |
| ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `@/components/event-detail-time`         | `EventDetailTime`, `EventDetailAllDay`                                                                                              | Start and end times and dates; the all-day switch.                                                                                                                                                 |
| `@/components/event-detail-time-field`   | `EventDetailTimeField`                                                                                                              | A time field with the floating time menu: typed times, durations, hover previews, and `Esc` restores. `EventDetailTime` renders two.                                                                |
| `@/components/event-detail-date-field`   | `EventDetailDateField`                                                                                                              | A date field with the date picker; `minDate` turns off earlier days.                                                                                                                               |
| `@/components/event-detail-timezone`     | `EventDetailTimezone`                                                                                                               | The time zone.                                                                                                                                                                                     |
| `@/components/event-detail-recurrence`   | `EventDetailRecurrence`                                                                                                             | The repeat rule, with arrows that step through the series when it repeats: `onPrevious` and `onNext` show the neighbors (`previousInSeries` / `nextInSeries`); leave one out to disable its arrow. |
| `@/components/event-detail-participants` | `EventDetailParticipants`                                                                                                           | Guests and rooms.                                                                                                                                                                                  |
| `@/components/event-detail-conferencing` | `EventDetailConferencing`                                                                                                           | The video call.                                                                                                                                                                                    |
| `@/components/event-detail-ai-notes`     | `EventDetailAiNotes`                                                                                                                | Whether AI meeting notes are on.                                                                                                                                                                   |
| `@/components/event-detail-location`     | `EventDetailLocation`                                                                                                               | The location.                                                                                                                                                                                      |
| `@/components/event-detail-links`        | `EventDetailLinks`                                                                                                                  | Links and attached files.                                                                                                                                                                          |
| `@/components/event-detail-description`  | `EventDetailDescription`                                                                                                            | The description.                                                                                                                                                                                   |
| `@/components/event-detail-calendar`     | `EventDetailCalendar`                                                                                                               | The calendar and its color.                                                                                                                                                                        |
| `@/components/event-detail-availability` | `EventDetailAvailability`                                                                                                           | Busy or free, and visibility.                                                                                                                                                                      |
| `@/components/event-detail-reminders`    | `EventDetailReminders`                                                                                                              | Reminders.                                                                                                                                                                                         |
| `@/components/event-detail-parts`        | `EventDetailGroup`, `EventDetailDivider`, `EventDetailSection`, `EventDetailRow`, `EventDetailPlaceholderRow`, `EventDetailTooltip` | Layout: groups of sections between dividers, rows on the panel's icon column, Notion's muted placeholder row, and the hover tooltip.                                                               |
| `@/components/event-detail-parts`        | `EVENT_DETAIL_*_CLASS`, `PANEL_*_CLASS`, `ROW_BOX_CLASS`                                                                            | The panel's colors and the styles of its inputs, rows and menus, in light and dark.                                                                                                                |
| `@/components/event-detail-parts`        | `closeMenuOnEscape`, `stopEscapePropagation`, `getPanelMenuSideOffset`, `getEventDetailPortalContainer`                             | Menu helpers: `Esc` closes a menu without deselecting the event, menus line up with the panel's edge, and lists portal into the dialog around the panel, if any.                                    |
| `@/components/event-detail-suggestions`  | `EventDetailSuggestions`, `EventDetailSuggestion`, `HighlightedMatch`, `handleSuggestionKey`                                        | The floating list a combobox field shows while typing (the participants' contacts, the location's places), its options, the matched text kept bright, and its arrow keys and `Enter`.                 |
| `@/hooks/use-inline-edit`                | `useInlineEdit`                                                                                                                     | A text field that edits in place: `Enter` or blur commits, `Esc` restores the value from before, and `onCommit` can reject a value by returning `null`.                                                |
| `@/hooks/use-hover-tooltip`              | `useHoverTooltip`                                                                                                                   | Open state for a tooltip that shows after the pointer rests on its trigger and stays while the pointer moves onto it.                                                                              |
| `@/hooks/use-field-popover`              | `useFieldPopover`                                                                                                                   | Focus, blur and `Esc` for a field whose menu or picker keeps focus in its input.                                                                                                                    |
| `@/lib/time-input`                       | `getStartTimeOptions`, `getEndTimeOptions`, `matchStartTimes`, `matchEndTimes`, `formatDuration`, `parseDateInput`                  | The time menu's options on the wall clock, the times and durations typed text can mean, and typed dates.                                                                                           |

## API Reference

### EventDetailPanel

`TEvent` extends `DetailedCalendarEvent`. Edits keep your other fields.

| Prop | Type | Description |
| --- | --- | --- |
| `event` (required) | `TEvent` | The event to show. |
| `onEventChange` | `(event: TEvent) => void` | Called with the edited event: on every keystroke in the title, and when a time, date or option is committed. Without it the panel is read-only: nothing accepts typing and the menus that change the event are disabled. |
| `headerActions` | `ReactNode` | Extra buttons in the header row, after the "..." menu. |
| `onTitlePreview` | `(event: TEvent) => void` | Set while the event is a draft that isn't stored yet, like `eventDraft` from `useCalendar()`. Called on every keystroke in the title instead of `onEventChange`, which then saves the draft: on Enter in a title, when focus leaves a title that changed, or on any other field's first edit. Escape takes the title back and saves nothing. Hides the "..." menu. |
| `autoFocusTitle` | `boolean` | Focuses and selects the title once, e.g. for a just-created event. |
| `onTitleAutoFocused` | `() => void` | Called after the title was auto-focused, so the request isn't repeated. |
| `onPrevWeek` | `() => void` | Shows the previous event of a repeating series (the repeat row's ‹). Leave it out at the start of the series to disable the arrow. The views' popover passes the provider's `previousInSeries`. |
| `onNextWeek` | `() => void` | Shows the next event of a repeating series (the repeat row's ›). Leave it out at the end of the series to disable the arrow. The views' popover passes the provider's `nextInSeries`. |
| `onCut` | `() => void` | The "..." menu's Cut (⌘X): keeps a copy of the event for pasting and deletes it. The item is disabled without it. The views' popover passes the provider's `cutEvent`. |
| `onCopy` | `() => void` | The "..." menu's Copy (⌘C): keeps a copy of the event for pasting. The item is disabled without it. The views' popover passes the provider's `copyEvent`. |
| `onDuplicate` | `() => void` | The "..." menu's Duplicate (⌘D): adds a copy at the same time and selects it. The item is disabled without it. The views' popover passes the provider's `duplicateEvent`. |
| `onDelete` | `() => void` | The "..." menu's Delete (delete): deletes the event. The item is disabled without it. The views' popover passes the provider's `deleteEvent`. |

### EventDetailsRenderProps

Passed to `renderEventDetails` on `CalendarProvider`.

| Field | Type | Description |
| --- | --- | --- |
| `event` | `TEvent` | The selected event. |
| `close` | `() => void` | Closes the popover by clearing the selection. |
| `isNew` | `boolean` | Whether the event was just created, as a draft or by `addEventFromRange`, so its title should be focused. True on the first render after creation only. |

### DetailedCalendarEvent

[`CalendarEvent`](/docs/components/calendar-core#calendarevent) plus the Notion Calendar-style details the panel reads and edits. Every field is optional.

| Field | Type | Description |
| --- | --- | --- |
| `kind` | `"event" \| "focus-time" \| "out-of-office" \| "birthday"` | Kind picked in the header menu. Defaults to "event". |
| `calendarId` | `string` | Calendar the event belongs to, an `id` from the provider's `calendars`. Without its own `color`, the event is drawn in this calendar's. |
| `calendarEmail` | `string` | Account email shown when `calendarId` isn't one of the provider's `calendars`. Moving the event sets it to the new calendar's `email`. |
| `description` | `string` | Free-text notes. |
| `location` | `string` | Where it happens. |
| `timeZone` | `string` | IANA time zone, e.g. "America/Sao_Paulo", shown as "GMT−3 Sao Paulo". Defaults to the viewer's zone. Picking another zone in the details keeps the event's wall-clock time. |
| `timezone` | `string` | Deprecated: a time zone label, e.g. "GMT-3 Sao Paulo", shown when `timeZone` is not set. |
| `recurrenceRule` | `RecurrenceRule` | Repeat rule, see [RecurrenceRule](#recurrencerule). Read as "Every 2 weeks on Mon, Thu". Takes precedence over `recurrence`; `.ics` import fills it and export writes it as an RRULE. |
| `recurrence` | `string` | Repeat rule as display text, e.g. "Every week on Thu", or an RRULE `.ics` import couldn't fit in `recurrenceRule` (it reads "Custom repeat"). Used when `recurrenceRule` is not set. |
| `excludedDates` | `Date[]` | Dates a repeating event skips, each the start of an occurrence (RFC 5545 `EXDATE`). `.ics` import and export read and write it. |
| `seriesId` | `string` | On an occurrence of a repeating event: the series' event id. Generated occurrences carry it, and an edited one is stored with it. |
| `originalStart` | `Date` | On an occurrence: its start in the series before any edit (RFC 5545 `RECURRENCE-ID`), so an edited occurrence replaces the right date. |
| `participants` | `EventParticipant[]` | Guests: `email`, `name`, `response` (accepted, declined, tentative, needs-action), `organizer`, `optional`, and `self` on the viewer, whose "declined" makes the event declined. |
| `rooms` | `EventRoom[]` | Meeting rooms: `id`, `name`, `location`, `capacity`, `response`. |
| `conference` | `EventConference` | Video call: `provider` ("google-meet", "zoom", "microsoft-teams" or "other"), `url`, `meetingId`, and `label`, the name of the `conferenceProviders` option that created it. |
| `aiMeetingNotes` | `boolean` | Whether AI meeting notes are taken. |
| `links` | `{ url: string; title?: string }[]` | Links attached to the event, shown by `title` when set. Only `http:` and `https:` addresses open; others, like `javascript:` or `data:`, show as text. |
| `attachments` | `{ name: string; url: string; size?: number; type?: string }[]` | Files attached to the event (size in bytes, MIME type). A `url` opens only when it's `http:`, `https:` or `blob:`; `javascript:` and `data:` show as text. A file attached in the panel gets a `blob:` URL that stops working when the page reloads. The panel revokes it when the file is removed; otherwise upload the file or revoke the URL yourself (`URL.revokeObjectURL`), e.g. when the event is deleted. |
| `reminders` | `{ amount: number; unit: "minutes" \| "hours" \| "days" \| "weeks"; time?: { hours: number; minutes: number } }[]` | Reminders before the event. `time` is the time of day for all-day events ("1 day before at 9 AM"). |
| `status` | `"busy" \| "free"` | Busy or free. |
| `visibility` | `"default" \| "public" \| "private"` | Visibility setting. |

### RecurrenceRule

The structured repeat rule in `recurrenceRule`: the part of an RFC 5545 RRULE the repeat row edits. Days are counted in the event's `timeZone`, from the series' first event, which always counts as the first occurrence. An all-day series counts whole days in the viewer's calendar.

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `frequency` (required) | `"daily" \| "weekly" \| "monthly" \| "yearly"` | – | How often it repeats (RRULE `FREQ`). |
| `interval` | `number` | `1` | Repeats every `interval` days, weeks, months or years (`INTERVAL`). |
| `weekdays` | `(0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6)[]` | – | Days a weekly rule falls on, 0 for Sunday (`BYDAY=MO,TH`). Defaults to the start's weekday. Monday to Friday reads as "Every weekday", Saturday and Sunday as "Every weekend day". |
| `monthlyBy` | `"day-of-month" \| "weekday-of-month"` | `"day-of-month"` | What a monthly rule repeats on: the start's day of the month ("on the 6th"; months without it, like the 31st in April, are skipped) or its weekday in the month ("on the 1st Sat"). |
| `weekOfMonth` | `1 \| 2 \| 3 \| 4 \| -1` | – | Which of the month's weekdays a "weekday-of-month" rule falls on: the 1st to 4th, or -1 for the last ("on the last Sat", `BYDAY=-1SA`). Defaults to the start's position in its month, the last for a fifth one. Set -1 to keep "the last Sat" when the start is also the 4th. |
| `weekStartsOn` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6` | `1` | Day the weeks of a weekly rule start on (`WKST`), which decides the weeks an "every 2 weeks" rule skips. Defaults to Monday, as in RFC 5545; independent of the calendar's `weekStartsOn`. |
| `end` | `RecurrenceEnd` | `{ type: "never" }` | When the series stops, see [RecurrenceEnd](#recurrenceend). |

### RecurrenceEnd

When a repeating event stops, by its `type`:

| type | Type | Description |
| --- | --- | --- |
| `"never"` | `{ type: "never" }` | Repeats forever. |
| `"on"` | `{ type: "on"; date: Date }` | Stops after the day of `date`, inclusive, a day in the event's time zone. Reads as "until Dec 6". `.ics` export writes an `UNTIL` at the end of that day (a date for all-day events). |
| `"after"` | `{ type: "after"; count: number }` | Stops after `count` occurrences, the first included. Reads as "for 7 times" (`COUNT`). |
