Schedule send (Pro)
ProIncluded in $99Run a prompt later or on a schedule: presets with the real time they mean, a custom time, repeat, the time zone written out, and Undo right after.
On this page
Installation
Needs chatcn Pro
This command works with a Pro license, along with every Pro component.
Or start free: sign up and get three Pro components on us, with a new one every month.
Usage
import { ScheduleSend } from "@/components/ui/chatcn/pro/schedule-send"
<ScheduleSend
timeZone="Europe/Lisbon"
onSubmit={({ text, schedule }) => (schedule ? queue(text, schedule) : send(text))}
onUndo={({ text }) => unqueue(text)}
/>The clock beside Send opens a panel. Each preset shows the time it actually means (In 1 hour 15:05, Tomorrow morning Thu 09:00), presets that make no sense right now disappear (no This evening at 19:20), and a custom date and time refuses the past with the time it will accept. Repeat runs once, daily, on weekdays or weekly. Once a time is set it sits above the text as a line you can change or drop, and Send becomes Schedule. After scheduling the message leaves the field and a notice says when it runs, with Undo until a hairline runs out; moving the pointer over it or focusing it holds the clock. Times are read and written in timeZone, and the zone is always shown in the panel. ScheduleSendPanel is exported on its own for a scheduler elsewhere in your app.
Examples
States
Props
| Prop | Type | Notes |
|---|---|---|
schedule, defaultSchedule, onScheduleChange | { at: Date; repeat } | null | repeat is "none" | "daily" | "weekdays" | "weekly" |
onSubmit | ({ text, schedule }) => void | schedule is null when the message was sent right away |
onUndo, undoMs | (submission) => void, number | Undo window, default 6000 ms |
timeZone, locale | string | IANA zone and locale. Default: the reader's |
presets | SchedulePreset[] | { id, label, at(now, timeZone) }; return null to hide one |
now | Date | A fixed clock for previews and tests |
defaultPanelOpen, defaultNotice | Open states, for previews | |
value, defaultValue, onValueChange | string | The draft, controlled or not |
status, onStop | "idle" | "submitting" | "streaming", () => void | Send becomes Stop in the same footprint |
disabled | boolean | |
tools, attachments | ReactNode | Toolbar start, above the text |
labels | Partial<ScheduleSendLabels> | Every string, for translation |
Keyboard
| Key | Action |
|---|---|
| Tab | Move through the presets, the date and time, repeat and Set time |
| Left, Right in Repeat | Choose once, daily, weekdays or weekly |
| Escape | Close the panel, focus back in the text |
| Enter, Shift Enter | Schedule (or send), new line. Never while an IME is composing |
Accessibility
- The clock button is named Send later; the time line names what it opens: Change the time, then the time.
- A time in the past marks both fields invalid and points them at the message that says what to pick.
- Scheduling is announced politely, and Undo is a real button that stays while it has focus.
- Repeat is a toggle group, so arrow keys move through it and the pressed state is announced.
Motion
The panel opens from the clock; the notice enters with a short rise and its hairline drains linearly for the undo window. Under reduced motion the hairline is hidden and the notice only fades, and the window still runs.