AI Send - React Component | Kokonut UI
AI Send
An email the assistant drafted, editable in place. Send starts a short countdown you can undo before anything goes out.
Installation
AI Send is a free, open-source React component in the Kokonut UI AI collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/ai-send.tsx, so the code is yours to change.
npx shadcn@latest add @kokonutui/ai-send
Or add it by hand: install its packages, then copy the source from above into components/kokonutui/ai-send.tsx.
npm install lucide-react motion
Usage
With no draft it plays the demo. Pass draft and it draws that email; the body follows it as it streams in, until the person types in it, and Send waits while writing is true. After Send, there are undoSeconds to take it back, then onSend gets the final text. Return a Promise and it shows sending until it resolves; throw and the draft comes back with your error's message.
The model writes the draft as a tool's input; the person sends it.
Props
- prompt:
string- The user's message, drawn as a bubble. Only the demo draws one by default. - message:
string- What the assistant says above the draft. - draft:
DraftEmail- The email, usually a tool's input. It can stream in: the body follows it until the person edits it. Leave it out for the demo. - writing:
boolean- Defaultfalse- The model is still writing the draft, so Send waits. - undoSeconds:
number- Default5- Seconds you have to undo before it really sends. - onSend:
(draft: DraftEmail) => void | Promise<void>- Called once the undo window has passed, with the final text. - className:
string- Extra classes for the root element.
DraftEmail
- from:
string(required) - toName:
string(required) - toEmail:
string(required) - subject:
string(required) - body:
string(required)
Dependencies
| Needs | Version | Comes from |
|---|---|---|
lucide-react |
^0.556.0 |
npm, installed by the CLI |
motion |
^12.23.25 |
npm, installed by the CLI |
cn from lib/utils.ts |
shadcn init | |
| React | 19 |
Your app |
| Tailwind CSS | 4 |
Your app |
No provider, font or global CSS to set up: the file works as soon as it lands.