Components
Details Sidebar
The right context panel of the demo, with the selected event's details, event search and the full keyboard shortcut list.
Details Sidebar is the right column of the live demo, Notion Calendar's context panel. It shows the selected event's details in the EventDetailPanel, and otherwise a search field and a list of useful shortcuts. While you mark open times inside a SchedulingProvider, it shows the scheduling panel: the meeting length, the text to copy and the marked times. On wide screens it's a fixed column beside the calendar; on narrower ones it opens as a sheet from the right (Sidebar Overlay).
It reads the events and the selection from the surrounding CalendarProvider, and edits the event through it.
Installation
pnpm dlx shadcn add @calendarcn/details-sidebarUsage
The panel's open state is shadcn/ui's SidebarProvider: open it with useSidebar() (toggleSidebar, setOpen), and set the provider's --sidebar-width to CONTEXT_PANEL_WIDTH. Put it last in the provider's row, after the calendar, and turn the views' popover off while the panel shows the details:
import { CalendarProvider } from "@/components/calendar-provider";
import {
CONTEXT_PANEL_WIDTH,
DetailsSidebar,
} from "@/components/details-sidebar";
import { SidebarProvider, useSidebar } from "@/components/ui/sidebar";
import { WeekView } from "@/components/week-view";
export function CalendarPage() {
return (
<CalendarProvider defaultEvents={events}>
<SidebarProvider
className="h-screen"
style={
{ "--sidebar-width": CONTEXT_PANEL_WIDTH } as React.CSSProperties
}
>
<Calendar />
<DetailsSidebar />
</SidebarProvider>
</CalendarProvider>
);
}
function Calendar() {
const { open, toggleSidebar } = useSidebar();
return (
<div className="flex min-w-0 flex-1 flex-col">
<WeekView showEventPopover={!open} onEventPopoverExpand={toggleSidebar} />
</div>
);
}On narrow screens, pass overlay. The demo shows the panel inline from 1280px wide and as an overlay below that, and opens the sheet when an event is selected on a phone (the views' popover doesn't fit beside an event there):
const isWide = useMediaQuery("(min-width: 1280px)");
const { isMobile, setOpenMobile } = useSidebar();
<CalendarProvider onEventSelect={() => isMobile && setOpenMobile(true)}>
{/* ... */}
<DetailsSidebar overlay={!isWide} />
</CalendarProvider>;Replace the shortcuts listed while nothing is selected with shortcuts:
<DetailsSidebar
shortcuts={[
{ label: "Command menu", keys: ["⌘", "K"] },
{ label: "Today", keys: ["T"] },
]}
/>Mark a shortcut your app doesn't handle yet with soon: true: its row shows a "Soon" badge in place of the keys. The default list has none: CalendarCN handles every shortcut it lists.
Search and the shortcut list from your commands
Pass a ref to actionsRef to open the panel from a command or a key: searchEvents(query?) opens it on event search with the field focused (and the text typed in, if you pass some), and showAllShortcuts() opens it on the full keyboard shortcut list. Both deselect a selected event, whose details would otherwise cover them. The demo calls them from the Command Menu and the ? key:
import type { DetailsSidebarActions } from "@/components/week-view-types";
const panelActions = React.useRef<DetailsSidebarActions>(null);
useCalendarShortcuts({
onShowShortcuts: () => panelActions.current?.showAllShortcuts(),
});
<DetailsSidebar actionsRef={panelActions} />;All keyboard shortcuts
The full list is Notion Calendar's: every shortcut under its group (General, Workflows, Editing, Calendar view, Calendar navigation, App navigation), the ones that act on an event under "With a selected event…". The field at the top finds one by name or by key, and Esc or its × goes back to the useful shortcuts. Selecting an event closes it too.
It lists KEYBOARD_SHORTCUT_GROUPS from lib/keyboard-shortcuts.ts (Calendar Core), every key the live demo handles. Pass shortcutGroups for your own: the demo leaves out ⌘, when it has no settings, with filterKeyboardShortcutGroups(). The default "Useful shortcuts" take their Go to date and full-list keys from the same file.
The panel uses the calendar sidebar's colors: see Colors.
Features
- Selecting an event shows its details, editable in place. Creating one focuses its title.
- Search events by title, from the field or from your command (
actionsRef). A repeating event is listed on each of its dates within a year of today. Results are grouped by day, past days dimmed, with "Today" always shown. Click a result to see its details, and "Search" to go back. - The repeat row's arrows step through a repeating event's series.
- The full keyboard shortcut list, with a field to find one by name or key.
- / and the panel's button toggle it in the demo (the shortcut is the page's own). As a sheet it closes on an outside tap or Esc, and opens without focusing the search field, so a phone's keyboard stays down.
API Reference
DetailsSidebar
Other props go to the inline panel's fixed column.
| Prop | Type | Default |
|---|---|---|
overlayRenders the panel as a sheet from the right (phones and tablets). | boolean | false |
shortcutsShortcuts listed while no event is selected or searched: { label, keys, soon }. Each key shows as a key cap; a soon one shows a "Soon" badge instead. | DetailsSidebarShortcut[] | USEFUL_SHORTCUTS |
shortcutGroupsThe full keyboard shortcut list showAllShortcuts() shows: groups of { label, keys, alternativeKeys, keywords }, with sections for the ones under a muted heading. | KeyboardShortcutGroup[] | KEYBOARD_SHORTCUT_GROUPS |
actionsRefReceives searchEvents(query?) and showAllShortcuts(), which open the panel on event search or the full shortcut list with its field focused. | Ref<DetailsSidebarActions> | – |
classNameClasses for the inline panel's fixed column, e.g. h-full to fit a container that isn't the viewport. | string | – |
CONTEXT_PANEL_WIDTH (309px) is the panel's width: Notion Calendar's 308px plus a 1px border. USEFUL_SHORTCUTS is the default list.