Mail Composer
Forms · MailComposer, RecipientInput, RichTextEditor
Writing a mail: from (a select when you may send from several addresses), To, Cc and Bcc as RecipientInput, subject, the text in the RichTextEditor, the signature with a switch, and attachments.
- Attachments:
onFilesgets the files picked on the device;attachSourcesadds places such as "From Drive" (your picker). Uploads show their progress; Send waits for them. - Draft: the whole draft goes to
onChange;savedandsavedAtshow "Draft saved 10:42". - Sending: Send or ⌘/Ctrl+Enter. With
onUndoSenda toast offers Undo forundoSeconds(default 10); hold the mail that long. "Send later" picks a date and time (onSchedule).
New messageDraft saved 10:42 AM
Mara Ellis
Head of Operations · Example Inc.
- pricing-v3.pdf1.2 MB
- seat-model.xlsx84 KB
Props
MailComposer
| Prop | Type | Notes |
|---|---|---|
senders? | { address: string; name?: string }[] | Addresses you may send from; a select when there are several. |
value? | MailDraft | The draft (controlled) / initially / on every change (save it as a draft). |
defaultValue? | Partial<MailDraft> | |
onChange? | (draft: MailDraft) => void | |
suggestions? | MailRecipient[] | |
suggest? | (typed: string) => MailRecipient[] | Promise<MailRecipient[]> | |
signature? | ReactNode | The signature shown under the text, with a switch to leave it out. |
onSend? | (draft: MailDraft) => void | Send (also ⌘/Ctrl+Enter); on only with valid recipients and no upload running. |
onUndoSend? | (draft: MailDraft) => void | Shows "Message sent" with Undo in a toast (needs a `<Toaster/>`). Hold the mail for `undoSeconds` and drop it when this is called. |
undoSeconds? | number | How long Undo stays (default 10 s). |
onSchedule? | (draft: MailDraft, at: Date) => void | "Send later" with a date and time. |
onFiles? | (files: File[]) => void | Files picked on this device (add them to `attachments` and upload). |
attachSources? | { label: string; icon?: IconName; onClick: () => void }[] | More places to attach from, e.g. "From Drive" (opens your picker). |
onRemoveAttachment? | (id: string) => void | |
saved? | "saving" | "saved" | "error" | null | Draft state: saving, saved (at `savedAt`) or failed. |
savedAt? | Date | |
onDiscard? | () => void | |
sending? | boolean | |
title? | string | Heading (default "New message"). |
placeholder? | string | |
minHeight? | number | |
autoFocus? | boolean | |
footer? | ReactNode | More controls in the footer. |
className? | string | Extra class on the root element. |
style? | CSSProperties | Inline style on the root element. |
RecipientInput
| Prop | Type | Notes |
|---|---|---|
label | string | Required |
hideLabel? | boolean | |
id? | string | |
value? | MailRecipient[] | The addresses (controlled) / initially / on change. |
defaultValue? | MailRecipient[] | |
onChange? | (value: MailRecipient[]) => void | |
suggestions? | MailRecipient[] | Known addresses, filtered while typing. |
suggest? | (typed: string) => MailRecipient[] | Promise<MailRecipient[]> | Or ask your server while typing (debounced). |
validate? | (address: string) => boolean | Your own address check (default: a plain e-mail pattern). |
placeholder? | string | |
hint? | string | |
error? | string | |
disabled? | boolean | |
autoFocus? | boolean | |
className? | string | Extra class on the root element. |
style? | CSSProperties | Inline style on the root element. |
RichTextEditor
| Prop | Type | Notes |
|---|---|---|
label? | ReactNode | |
hideLabel? | boolean | Hide the label visually; it stays the editor's accessible name. |
defaultValue? | string | |
value? | string | |
onChange? | (html: string) => void | |
placeholder? | string | |
variables? | { key: string; label: string }[] | |
maxLength? | number | |
minHeight? | number | |
footer? | ReactNode | |
hint? | ReactNode | |
error? | ReactNode | |
disabled? | boolean | |
className? | string | Extra class on the root element. |
style? | CSSProperties | Inline style on the root element. |