Email & Newsletter Forms

Capture email signups with provider-agnostic EmailSubscribeForm, FooterCallToAction, submitFormData helper, and formRules.

Provider-Agnostic Philosophy

@nuxtify/pages (and @nuxtify/cms, which includes it) does not lock you into a specific newsletter or email marketing platform. Whether you use MailerLite, ConvertKit/Kit, Buttondown, Loops, Formspree, or your own Nuxt server route, you can either point Nuxtify's built-in EmailSubscribeForm at a POST endpoint or drop in your provider's embed.

Quick Setup with EmailSubscribeForm & FooterCallToAction

Configure your default submission URL and optional footer CTA copy in app.config.ts:

// app/app.config.ts
export default defineAppConfig({
  nuxtify: {
    email: {
      provider: {
        defaultSubmitUrl: 'https://your-provider.example.com/subscribe',
      },
    },
    footer: {
      cta: {
        title: 'Stay in the loop',
        subtitle: 'Get release notes and Nuxt tips in your inbox.',
        color: 'primary',
      },
    },
  },
})

Once email.provider.defaultSubmitUrl is set, FooterCallToAction renders EmailSubscribeForm automatically in the footer. You can also place EmailSubscribeForm directly in any Vue component or Markdown page:

<template>
  <EmailSubscribeForm
    :submit-url="nuxtifyConfig.email?.provider?.defaultSubmitUrl || '/api/subscribe'"
    button-text="Join Waitlist"
    email-placeholder="you@company.com"
    marketing-consent-text="No spam. Unsubscribe any time."
    show-privacy
    thank-you-message="You're on the list!"
  />
</template>

EmailSubscribeForm Props

PropTypeDefaultDescription
submitUrlstringRequiredEndpoint URL that receives the POST FormData payload.
buttonTextstring'Subscribe'Submit button label.
emailPlaceholderstring'Enter your best email'Input placeholder text.
marketingConsentTextstring'Unsubscribe any time.'Supporting note rendered below the input.
showPrivacybooleanfalseAppends a link to nuxtify.routes.privacy beneath the form.
redirectUrlstring''Optional internal or external URL to navigate to after a successful signup.
thankYouMessagestring'Thanks for signing up!'Inline confirmation message shown when redirectUrl is omitted.
darkbooleanfalseAdjusts validation and supporting text contrast for dark surfaces (used by FooterCallToAction).
prependButtonIconstring''Optional MDI icon prepended to the submit button.
appendButtonIconstring''Optional MDI icon appended to the submit button.

What EmailSubscribeForm Sends

When a visitor submits a valid email address, EmailSubscribeForm:

  1. Validates the input with formRules.required and formRules.validEmail.
  2. Builds a FormData payload with email, referrer (current base URL), and any active UTM query parameters (utm_source, utm_medium, utm_campaign, utm_term, utm_content).
  3. Submits via the auto-imported submitFormData(submitUrl, formData) utility, triggers useAnalytics().userSignUp() on success, and either redirects to redirectUrl or displays thankYouMessage.

Using submitFormData Directly

If you're building a custom signup or contact form, you can reuse the submitFormData utility directly. It sends a POST request with FormData and returns a structured { isSubmitted, isError, errorMessage } result:

const formData = new FormData()
formData.append('email', email.value)
formData.append('name', name.value)

const { isSubmitted, isError, errorMessage } = await submitFormData('/api/contact', formData)

Building Custom Forms with formRules & AppToast

For custom contact forms, waitlists, or third-party embeds, combine Vuetify's <v-form> with Nuxtify's built-in formRules and global toast state (useToast + AppToast):

<script setup lang="ts">
import type { VForm } from 'vuetify/components'

const form = ref<VForm>()
const loading = ref(false)
const email = ref('')
const message = ref('')
const toast = useToast()

async function onSubmit() {
  const result = await form.value?.validate()
  if (!result?.valid) return

  loading.value = true
  const payload = new FormData()
  payload.append('email', email.value)
  payload.append('message', message.value)

  const { isError, errorMessage } = await submitFormData('/api/contact', payload)
  loading.value = false

  toast.value.message = isError
    ? `Could not send message: ${errorMessage}`
    : 'Message sent! We will reply shortly.'
  toast.value.show = true
}
</script>

<template>
  <v-form
    ref="form"
    validate-on="submit"
    @submit.prevent="onSubmit"
  >
    <v-text-field
      v-model="email"
      label="Email"
      type="email"
      variant="outlined"
      :rules="[formRules.required, formRules.validEmail]"
    />

    <v-textarea
      v-model="message"
      label="Message"
      variant="outlined"
      :rules="[formRules.required, formRules.minLength12, formRules.maxLength1200]"
    />

    <v-btn
      type="submit"
      color="secondary"
      :loading="loading"
    >
      Send Message
    </v-btn>
  </v-form>
</template>

Nuxtify includes ready-to-use formRules validators for required values (required, requiredArray), email format (validEmail), string lengths (minLength8, minLength12, maxLength30 through maxLength10000), and numbers (isInteger, gt0, gte6, lte12, lte365).

Embedding Third-Party Forms

If your email provider requires its own script or iframe (for example, Substack, Beehiiv, or Tally), override FooterCallToAction.vue by creating app/components/FooterCallToAction.vue—or create a dedicated custom component in app/components/ and drop it straight into your Markdown pages with MDC syntax.

Next Steps