X Enterprises
nuxt-x-app

Email

Rich email composer with grouped recipient autocomplete, CC support, rich-text body, and file attachments.

Email

The Email category provides a self-contained email compose interface. It handles recipient search with grouped autocomplete (supporting custom email entry), CC, subject, rich-text body editing, and file attachments — all without any external email SDK dependency.

Components

<XAEmailComposer />

A vertically-oriented compose panel with To and CC fields backed by a grouped recipient popover. Recipients are selected from availableRecipients (keyed by group) or typed in freeform. Emits a structured payload on send.

<XAEmailComposer
  :available-recipients="{
    homeowner: { id: '1', name: 'Jane Smith', email: 'jane@example.com' },
    contractors: [
      { id: '2', name: 'Bob Plumbing', email: 'bob@plumbing.com', type: 'contractor' },
    ],
    contacts: [],
  }"
  :recipient-groups="[
    { key: 'homeowner', label: 'Homeowner', icon: 'i-lucide-home' },
    { key: 'contractors', label: 'Contractors', icon: 'i-lucide-hard-hat' },
    { key: 'contacts', label: 'Contacts', icon: 'i-lucide-users' },
  ]"
  :default-to="['jane@example.com']"
  default-subject="Project Update"
  project-name="123 Main St Renovation"
  :sending="isSending"
  @send="handleSend"
  @cancel="closeComposer"
  @save-draft="saveDraft"
/>

Props

PropTypeDefaultDescription
availableRecipientsRecord<string, Recipient | Recipient[]>{}Keyed recipient data by group — each value is a single recipient or an array
recipientGroupsRecipientGroup[][homeowner, contractors, contacts]Ordered group definitions displayed in the recipient popover
defaultTostring[][]Pre-populated To email addresses
defaultCcstring[][]Pre-populated CC email addresses
defaultSubjectString''Pre-populated subject line
defaultBodyString''Pre-populated email body
projectNameString''Context label shown in the composer header
sendingBooleanfalseShow loading state on the Send button

Recipient shape:

FieldTypeDescription
idstring?Optional ID
emailstringEmail address (required)
namestringDisplay name (required)
avatarstring?Avatar URL
typestring?Recipient type label (displayed as a badge)

RecipientGroup shape:

FieldTypeDescription
keystringMatches key in availableRecipients
labelstringGroup heading in the popover
iconstring?Lucide icon name for the group

Emits

EventPayloadDescription
send{ to: string[], cc: string[], subject: string, body: string, attachments: File[] }User clicked Send — all selected recipient emails
cancelUser clicked Cancel
save-draftUser clicked Save Draft

AI Context

category: Email
package: "@xenterprises/nuxt-x-app"
components:
  - XAEmailComposer
use-when: >
  Building email send functionality within an app — project communication,
  client outreach, notifications. Does not send email itself; emits a
  structured payload that the parent handles (e.g., passes to an API route).
key-patterns:
  - availableRecipients keys must match recipientGroups keys
  - Each group value can be a single Recipient or Recipient[] array
  - Custom freeform email addresses can be typed and added with Enter
  - The send event payload includes resolved email strings, not Recipient objects
  - Set sending: true while awaiting the API response to disable the Send button
Copyright © 2026