Interactive Answers
Slot Picker
Pick a time the agent proposed — days, free slots, time zone and a confirm step.
3 variantsMIT
Preview
Installation
Copies the component into components/ui and installs its dependencies and theme tokens.
pnpm dlx shadcn@latest add https://uilab.tmih06.com/r/slot-picker.jsonUsage
Pass your own data and wire the callbacks to your agent runtime.
import { SlotPicker } from "@/components/ui/slot-picker";
// The scheduling agent proposes free slots from both calendars.
export function ProposeTimes({ proposal }: { proposal: Proposal }) {
return (
<SlotPicker
data={{
title: proposal.title,
slots: proposal.slots, // { id, day: "2026-11-10", start: "14:30", end: "15:00", busy?, suggested? }
timeZone: { label: "Lisbon (UTC+0)", offset: 0 },
attendeeZone: { label: "New York (UTC−5)", offset: -5 },
}}
onConfirm={(slot) => agent.sendToolResult(proposal.callId, { slotId: slot.id })}
/>
);
}
// While the calendars are being read, pass null — the week grid loads as blank
// day columns of pill placeholders, none of them selectable.
export function ProposeTimesLoading({ query }: { query: ProposalQuery }) {
return (
<SlotPicker
data={query.proposal ?? null}
loading={query.isRefetching}
skeleton={{ count: 4 }}
onConfirm={(slot) => agent.sendToolResult(query.callId, { slotId: slot.id })}
/>
);
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
| data* | { title?: string; slots: Slot[]; timeZone: SlotZone; attendeeZone?: SlotZone } | null | — | Candidate slots in `timeZone`. With `attendeeZone` a switch shows the times in the other person's zone. Pass null while they load — an empty slots array is valid: no availability. |
| loading | boolean | false | Force the layout-preserving skeleton while refetching, even when stale slots are available. |
| skeleton | { count?: number } | — | Shape hints for the loading state; count is the number of placeholder rows per day column. |
| variant | "week" | "day" | "week" | Day columns for up to five days, or one day at a time with durations. |
| selectedId / onSelect | string | null | — | The picked slot. Picking shows a confirm row under the panel. |
| onConfirm | (slot: Slot) => void | — | Called from the confirm row; the card switches to the confirmed summary. |
| confirmedId / onChange | string | null | — | Controls the confirmed state. onChange fires from “Pick another time”. |
| locale | string | "en-US" | BCP 47 locale for day names and dates. |
| labels | Partial<SlotPickerLabels> | — | Your own UI strings (Their time, Suggested, Confirm, the loading announcement…), for translating. Right-to-left works under `dir="rtl"`. |
| className | string | — | Extra classes for the shell. |
type Slot = {
id: string;
day: string; // ISO date
start: string; // "HH:MM" in data.timeZone
end: string;
busy?: boolean; // shown striped and disabled
suggested?: boolean; // marked with a dot
};
type SlotZone = { label: string; offset: number }; // hours from UTC