Contact form for v0
v0 by Vercel generates Next.js (App Router) components with Tailwind and shadcn/ui. Its forms look finished but don't send anywhere until you give them an endpoint. Ask v0 to post to Pasteform, or drop in the client component below.
Get my free form link Replace YOUR_FORM_ID below with your form ID, or copy the snippets from your dashboard where it's already filled in.
Step by step
- Create a form in Pasteform and copy your endpoint URL.
- Ask v0: “Make the contact form a client component that POSTs JSON to <endpoint> and shows a success state”, or paste the prompt from your form page.
- Make sure the file starts with
"use client"; the form posts from the visitor's browser. - Deploy to Vercel and add your
*.vercel.appproduction hostname and custom domain to Allowed domains.
components/contact-form.tsx
"use client";
import { useState } from "react";
export default function ContactForm() {
const [state, setState] = useState<"idle" | "sending" | "sent" | "error">("idle");
const [error, setError] = useState("");
async function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
e.preventDefault();
setState("sending");
const form = e.currentTarget;
const res = await fetch("https://forms.prizenlabs.com/f/YOUR_FORM_ID", {
method: "POST",
headers: { "Content-Type": "application/json", Accept: "application/json" },
body: JSON.stringify(Object.fromEntries(new FormData(form))),
});
const data = await res.json().catch(() => ({}));
if (res.ok && data.success) {
form.reset();
setState("sent");
} else {
setError(data.message ?? "Something went wrong");
setState("error");
}
}
if (state === "sent") return <p>Thanks! We'll be in touch soon.</p>;
return (
<form onSubmit={handleSubmit} className="space-y-3">
<input name="name" placeholder="Name" required />
<input name="email" type="email" placeholder="Email" required />
<textarea name="message" placeholder="Message" required />
<input name="_gotcha" className="hidden" tabIndex={-1} autoComplete="off" />
<button type="submit" disabled={state === "sending"}>
{state === "sending" ? "Sending…" : "Send"}
</button>
{state === "error" && <p role="alert">{error}</p>}
</form>
);
}
Allowed domains
Add your production domain. Vercel preview deployments get unique hostnames; add the ones you test on, or test with an empty allow-list.
Common pitfalls
- Don't call the endpoint from a Server Action or route handler: server requests carry no Origin header, so they are rejected once you set an allow-list.
- shadcn/ui
<Input>components passnamethrough, sonew FormData(form)picks them up. Just give every field aname.
What you get
- Email notifications with Reply-To set to your visitor, plus optional Slack, Discord, Telegram or webhook alerts.
- Spam protection: honeypot, rate limits, domain allow-list, optional Cloudflare Turnstile.
- Submissions stored for as long as you choose (or not at all), with CSV export and one-click deletion.
- Free for 250 submissions a month; Pro is $9/month for 5,000.
Guides for other platforms
Lovable · Bolt · Framer · Webflow · Astro · Next.js · Hugo · Jekyll · GitHub Pages · Netlify · Vercel · WordPress (static export) · Carrd · plain HTML