Skip to content

Events

EventPayloadWhen
update:designEmailDocumentOn every design change — the event that powers v-model:design.
changeEmailDocumentSame as update:design, for when you'd rather not use v-model.
export-htmlstringWhen calling exportHtml() via ref — delivers the generated HTML.
ai-templates-errorAiTemplateErrorPayloadWhen dynamic context resolution, the host provider callback, or returned proposal validation fails. operation is `'context'
autosave-statusAutosaveStatusPayloadWhen autosave changes status: 'disabled', 'idle', 'restoring', 'saving', 'saved', or 'error'.
autosave-savedAutosaveSavedPayloadAfter a save succeeds. Includes the saved design snapshot and savedAt.
autosave-restoredAutosaveRestoredPayloadAfter a saved draft is applied to the builder. Includes the restored design snapshot and restoredAt.
autosave-errorAutosaveErrorPayloadAfter a load or save failure. Includes `operation: 'load'
vue
<template>
  <EmailBuilder
    v-model:design="design"
    @change="onChange"
    @export-html="onHtml"
    @autosave-status="onAutosaveStatus"
    @autosave-error="onAutosaveError"
  />
</template>

<script setup lang="ts">
function onChange(doc: EmailDocument) {
  // react to every document change
}

function onHtml(html: string) {
  // send or preview
}

function onAutosaveStatus(payload: AutosaveStatusPayload) {
  // update UI for saving, saved, or error states
}

function onAutosaveError(payload: AutosaveErrorPayload) {
  // log or surface adapter failures
}
</script>

For the full request/response contract and provider security guidance, see AI template generation.

See also Autosave for restore behavior and the full autosave payloads, and Methods for getAutosaveStatus() and export helpers.

Released under the MIT License. llms.txt for AI assistants.