How to add a form to Alpine.js
A few Alpine.js attributes turn a plain form into one that sends to FormTango without a page reload.
- 1
Create a free FormTango account and add a form. Copy its endpoint, which looks like https://formtango.com/f/YOUR_FORM_ID.
- 2
Add the form below, replacing YOUR_FORM_ID.
- 3
Submit the form once. The submission appears in your FormTango inbox and you get an email.
html
<div x-data="{ status: 'idle' }">
<p x-show="status === 'sent'">Thanks! We got your message.</p>
<form x-show="status !== 'sent'"
@submit.prevent="
status = 'sending';
fetch('https://formtango.com/f/YOUR_FORM_ID', { method: 'POST', headers: { Accept: 'application/json' }, body: new FormData($event.target) })
.then(r => status = r.ok ? 'sent' : 'error')
.catch(() => status = 'error')">
<input type="email" name="email" required>
<textarea name="message" required></textarea>
<button :disabled="status === 'sending'">Send</button>
<p x-show="status === 'error'" role="alert">Something went wrong. Please try again.</p>
</form>
</div>What you get
- Every submission saved in an inbox you can search and export.
- An email for each one, with the visitor's address as the reply-to.
- Spam filtering without making visitors solve a puzzle.
- Problems? See troubleshooting.
Related guides
Last reviewed November 19, 2026.