Guides
Meet with people
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. In the preview, each button opens it in one of its two modes, with the sample data's people.
Installation
pnpm dlx shadcn@latest add @calendarcn/people-pickerUsage
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.
Examples
Your own list of who was picked
The people are provider state, so a list of your own stays in sync with the picker: here each person in the meeting is a button that takes them out.
Teammates, loaded as they're picked
Control teammates to know who was picked, and load their events in onTeammatesChange.
API Reference
PeoplePicker
| Prop | Type | Default |
|---|---|---|
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 | – |
modeMeet with the picked person, or show their calendar. Also sets the placeholder: "Meet with..." or "Show teammate calendar...". | "meet-with" | "teammate" | "meet-with" |