flohoeller

Email Draft

AI chats 63

About

An agent-written email for review – switch recipient and tone, edit inline, remove the attachment, send or discard with undo. Follows your shadcn theme, light and dark. From affectUI (affectui.com).

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Email Draft to your project and fits it to your theme.

Code

How Email Draft is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { EmailDraft, type DraftContact, type DraftTone } from "@/components/ui/email-draft";

// A renewal reminder an agent drafted – everything the card shows comes in through props
const contacts: DraftContact[] = [
  { name: "Jonas Weber", email: "jonas@northwind.io" },
  { name: "Lena Hart", email: "lena@northwind.io" },
  { name: "Finance team", email: "billing@northwind.io" },
];

const firstName = (c: DraftContact) => c.name.trim().split(/\s+/)[0] ?? "";

const tones: DraftTone[] = [
  {
    id: "friendly",
    label: "Friendly",
    body: (c) =>
      `Hi ${firstName(c)}, a heads-up that your Growth plan renews on October 9 for $8,900 a year. If you'd like to add seats or switch to monthly billing, you can review the quote here:`,
  },
  {
    id: "short",
    label: "Short",
    body: (c) => `Hi ${firstName(c)}, your Growth plan renews on October 9 ($8,900/year). Quote for changes:`,
  },
  {
    id: "formal",
    label: "Formal",
    body: (c) =>
      `Dear ${c.name}, this is a reminder that your Growth subscription is scheduled to renew on October 9 at $8,900 per year. Should you wish to adjust seats or billing, please review the attached quote:`,
  },
];

export default function Demo() {
  return (
    <div className="ed-demo">
      <style>{demoCss}</style>
      <EmailDraft
        reference="SUB-1182"
        account="Northwind Logistics"
        amount="$8,900"
        status="Renews in 5 days"
        agent="Renewal agent"
        contacts={contacts}
        attachment="Renewal-quote.pdf"
        tones={tones}
        link={{ label: "Review quote", href: "#" }}
      />
    </div>
  );
}

const demoCss = `
/* Centered in the preview on the theme's background */
.ed-demo {
  display: grid;
  grid-template-columns: minmax(0, 520px);
  place-content: center;
  width: 100%;
  min-height: 100vh;
  padding: 32px 16px;
  box-sizing: border-box;
  background: var(--color-background, #ffffff);
}
`;

More by flohoeller

View all
  • Otp Input

    Otp Input

    46
  • Message Actions

    Message Actions

    38
  • Thinking Loader

    Thinking Loader

    37
  • Tool Call Card

    Tool Call Card

    12
  • Segmented Control

    Segmented Control

    8

More in AI chats

View all
  • AI Actions

    AI Actions

    336
  • Aquarium Prompt

    Aquarium Prompt

    21
  • Attachments

    Attachments

    32
  • Agent Chat

    Agent Chat

    18
  • Color Picker

    Color Picker

    158
  • Message Thread

    Message Thread

    55
  • Chat Bubble

    Chat Bubble

    195
  • Commit

    Commit

    27