Docs / Contact form guides
Add a contact form to a Nuxt site
A Nuxt contact form from one prompt or one component, with no server handler.
Add a working contact form to this Nuxt project. Create the form by sending POST https://wrenform.com/api/v1/quick-forms with JSON {"email": "YOUR_EMAIL", "framework": "nuxt"} (if you can't make HTTP requests, give me the curl command to run). Put the returned snippet on a /contact page or section, matching the site's style: a label for each field, type="email" on the email field, and keep the _honey field exactly as returned. Show a thank-you message after sending and an error message on failure. Put the form in components/ContactForm.vue and use it on pages/contact.vue. No server/api route. Add no dependencies, API keys or server code. Then tell me to check my inbox for the Wrenform email and click Confirm, because messages are held until I do.Replace YOUR_EMAIL with the address that should get the messages, and paste. This creates a form without an account: no sign-up, no mail provider, free for 250 submissions a month. Nothing is forwarded until you click Confirm in the email we send, and unconfirmed forms are deleted after 7 days. Prefer the dashboard? Create a form and use the snippet below.
A Nuxt contact form usually needs a server/api handler and a mail provider. With Wrenform the visitor's browser posts straight to the endpoint, so the page can be prerendered with nuxt generate and there is no secret to store.
Steps
- Paste the prompt into your coding tool, or save the component below as
components/ContactForm.vue. - Put
<ContactForm />onpages/contact.vue. Nuxt auto-imports the component,refand$fetch. - Click Confirm in the email from Wrenform.
- Deploy.
Lock the form to your site. A form created this way accepts posts from any site. Once you've confirmed, sign in with the same address and add your published domain under Allowed origins in the form's settings, for example https://example.com.
Or paste the code
<!-- components/ContactForm.vue (Nuxt 3): ref and $fetch are auto-imported -->
<script setup lang="ts">
const status = ref<"idle" | "sending" | "sent" | "error">("idle");
async function onSubmit(e: Event) {
const form = e.target as HTMLFormElement;
status.value = "sending";
try {
await $fetch("https://wrenform.com/f/YOUR_FORM_ID", {
method: "POST",
headers: { Accept: "application/json" },
body: new FormData(form),
});
status.value = "sent";
form.reset();
} catch {
status.value = "error";
}
}
</script>
<template>
<form action="https://wrenform.com/f/YOUR_FORM_ID" method="POST" @submit.prevent="onSubmit">
<label>Name <input type="text" name="name" autocomplete="name" required /></label>
<label>Email <input type="email" name="email" autocomplete="email" required /></label>
<label>Message <textarea name="message" required></textarea></label>
<input type="text" name="_honey" style="display:none" tabindex="-1" autocomplete="off" />
<button type="submit" :disabled="status === 'sending'">Send</button>
<p role="status">
<span v-if="status === 'sent'">Thanks, your message was sent.</span>
<span v-if="status === 'error'">Something went wrong. Please try again.</span>
</p>
</form>
</template>The form keeps its action and method, so a visitor who sends it before the page hydrates still gets through as a plain HTML post. Set Redirect to in the form's settings to your thank-you page for that case (see redirects).
Spam and email
- The hidden
_honeyfield catches most bots. Keep it in the form, hidden, withautocomplete="off". - A timing check marks submissions sent less than 3 seconds after the form loaded as spam, when the form sends the timing field. The optional script in the HTML snippet adds it; see the timing field. No captcha is needed.
- Each real submission is emailed to you and shown in your dashboard. If a field is missing from the email, check that its input has a
nameand isn't disabled. - Submissions are stored in the EU. Free keeps them for 30 days, paid plans for 365 days.
Test it
Run npx nuxi dev, open /contact and send the form. After confirming, the message is in your inbox and your dashboard. Send one more from the deployed site.
Common problems
- The form sends but no email arrives. The address hasn't confirmed yet. Look for the email from Wrenform, also in spam.
403 origin_not_allowed. The page's origin isn't in the form's Allowed origins. Add it, including any preview domain you test from. See errors.- The action URL ends in
/f/. The form ID isn't set: replaceYOUR_FORM_IDin both places in the component. $fetchis not defined. The file is outside a Nuxt app. Use the Vue guide, which posts withfetch.- Anything else. See troubleshooting.
Next steps
- Nuxt guide: the form ID in
runtimeConfigand a strict CSP. - Prompts for AI builders: the same prompt for other tools.
- Pricing: free for 250 submissions a month, paid plans from €5.