RegistryInstall CalendarCN with the shadcn CLI

Components

People Picker

Notion Calendar's F and P dialog, to meet with someone or show a teammate's calendar.

PeoplePicker is the dialog the live demo opens with F ("Meet with...") and P ("Show teammate calendar..."), and from the same commands in the Command Menu. It searches the provider's contacts by name or email, and offers a typed address no contact has. Picking someone meets with them or shows their calendar through useCalendarPeople(), so it goes inside CalendarProvider.

Installation

pnpm dlx shadcn add @calendarcn/people-picker

Usage

import { useCalendarShortcuts } from "@/hooks/use-calendar-shortcuts";
import { CalendarProvider } from "@/components/calendar-provider";
import { PeoplePicker } from "@/components/people-picker";
import { WeekView } from "@/components/week-view";
import type { PeoplePickerMode } from "@/components/calendar-types";

export function Schedule() {
  return (
    <CalendarProvider
      defaultEvents={events}
      contacts={contacts}
      contactEvents={contactEvents}
    >
      <CalendarWithPeople />
    </CalendarProvider>
  );
}

function CalendarWithPeople() {
  const [open, setOpen] = React.useState(false);
  const [mode, setMode] = React.useState<PeoplePickerMode>("meet-with");
  const openPicker = (next: PeoplePickerMode) => {
    setMode(next);
    setOpen(true);
  };

  // F and P open it, as in Notion Calendar
  useCalendarShortcuts({
    onMeetWith: () => openPicker("meet-with"),
    onShowTeammateCalendar: () => openPicker("teammate"),
  });

  return (
    <>
      <WeekView />
      <PeoplePicker open={open} onOpenChange={setOpen} mode={mode} />
    </>
  );
}
  • "meet-with" adds the person to the meeting: their events show beside yours and the times you're all free are highlighted. An event you create meanwhile invites them. See Meeting with people.
  • "teammate" shows their calendar beside yours, without a meeting.

The people already added are left out of the list. The arrow keys move through it, Enter picks, and Esc closes the picker, which opens empty the next time. The Calendar Sidebar lists who was picked, each removable.

API Reference

PeoplePicker

PropTypeDefault
open (required)
Whether the picker is open.
boolean–
onOpenChange (required)
Called when the picker opens or closes: on Escape, a click outside, or once someone is picked.
(open: boolean) => void–
mode
Meet with the picked person, or show their calendar. Also sets the placeholder: "Meet with..." or "Show teammate calendar...".
"meet-with" | "teammate""meet-with"

On this page