---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Draft email card

An email an assistant drafted, ready to send, for a page's column or a chat's reply, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `DraftEmailCard`.

## Try it

Change the subject and press Send email (by pointer, Enter or Space): it turns to Sent and the subject it carried is shown; press the close and the card goes, Restore draft brings it back; turn on Disabled and nothing in it takes a press; Tab walks the send, the close and the fields in order.

Send email sends nothing: the draft it hands over is only shown.

## When to use

- An email an assistant drafted, ready to send, for a page's column or a chat's reply.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Draft email card on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-draft-email-card.json --yes
```

```text
Add the Goop Draft email card to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { DraftEmailCard } from '@/components/ui/goop/draft-email-card';
import { useState } from 'react';

function CrewDraft({ send, onClose }: { send(to: string, subject: string, message: string): void; onClose(): void }) {
  const [sent, setSent] = useState(false);
  return (
    <DraftEmailCard
      to="crew@example.com"
      from="mira@example.com"
      senders={['mira@example.com', 'office@example.com']}
      subject="Planting day: gloves and trailer"
      message={'Hi all,\n\nBring gloves on Saturday.\n\nMira'}
      sent={sent}
      onSend={(draft) => {
        send(draft.to, draft.subject, draft.message);
        setSent(true);
      }}
      onDismiss={onClose}
    />
  );
}
```

- Fits: chat: body; overview, record: aside.
- Put it in a page's column or under the assistant's reply, the column's width; stack several 12 px apart. The card removes nothing itself: on close take it away and move the focus to the next card's close (`dismissRef`), or to what brings the drafts back when none is left. A new draft for the same card takes a new `key` (the rows keep the words the reader typed).
- width, gap: add no class for these.

## API reference

### Options

- `to: string` — Who it goes to: the To row's starting words.
- `from: string` — Who it is from: the From menu's starting choice.
- `senders?: readonly string[] | undefined` — The addresses the From menu offers (`from` first when it is not among them); `from` alone when left out.
- `subject?: string | undefined = ''` — The Subject row's starting words.
- `message?: string | undefined = ''` — The message's starting words (line breaks kept).
- `onSend?: ((draft: DraftEmail) => void) | undefined` — The send action, pressed (the pointer, Enter or Space): handed the draft as the reader left it.
- `sent?: boolean | undefined = false` — The email is sent: the action reads its sent words, and the card says so politely.
- `onDismiss?: (() => void) | undefined` — The close, pressed: take the card away and move the focus to the next one.
- `dismissRef?: Ref<HTMLButtonElement> | undefined` — The close's own button, for the focus a caller moves to the next card's close.
- `disabled?: boolean | undefined` — The whole card off: the strip's two buttons and every row and the message, so none takes a press, words or a Tab stop.
- `labels?: Partial<DraftEmailCardLabels> | undefined` — The card's words, each replaceable.

- Types: DraftEmail = { to: string; from: string; subject: string; message: string }; DraftEmailCardLabels = { kind: string; send: string; sent: string; sentStatus: string; dismiss: string; to: string; from: string; subject: string; message: string; senders: string }

## Keyboard

- Enter / Space: on Send email or the close, press it once
- Tab: from the send to the close, then the To, From and Subject fields and the message

## Accessibility

- The part itself answers the keys above.
- disabled: the prop disabled

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Event proposal card](/themes/trail/components/event-proposal-card): A calendar event an assistant proposes, ready to add, for a page's column or a chat's reply.
- [Inline edit](/themes/trail/components/inline-edit): Words that read as plain text and become an editable field in place, such as a record's title or a property's value.
- [Profile card](/themes/trail/components/profile-card): A person's own page header, for an account, profile, customer or patient page.
- [Promo card](/themes/trail/components/promo-card): A card that offers something (an app to download, a plan to upgrade to, a feature that is new), for a page or a settings pane.
