Next.js contact form in 5 minutes,
with 2 lines of code
Build a multi-step form in a no-code editor, paste 2 lines into any page, and you're live. Edit it any time without a redeploy, with Meta and TikTok server-side tracking and cookie consent built in.
7-day trial · No credit card · From $20/mo, billed yearly
- No-code editor
- 5-minute setup
- 2 lines of code
- Multi-step forms
- Edit without redeploying
- Meta + TikTok server-side
- Built-in cookie consent
2 lines of code, and your Next.js contact form is live
Load the script and place the form. There's no API route, Server Action or email provider to set up.
This is the real embed, running on this Next.js page. Go ahead and try it. It's in template mode here, so nothing is saved or tracked.
import Script from "next/script" export default function ContactPage() { return ( <> <Script type="module" crossOrigin="anonymous" src="https://cdn.collectform.com/collectform.js" /> <collectform-embed form-id="YOUR_FORM_ID" /> </> )}Works inside a Server Component, so you don't need "use client".
From sign-up to live form in 5 minutes
Build it without code
Start from a template or a blank form. Lay out your steps in the drag-and-drop editor, add conditional logic, then match your site's colors and fonts.
Paste 2 lines
Grab your form ID from the Share tab and drop the 2 lines into any page or component. Your layout and routes stay as they are.
Hit Publish
Your form is live. Submissions land in your dashboard, with email alerts and webhooks when you want them somewhere else too.
Edit your Next.js form without a redeploy
The embed loads your published form every time the page loads. Add a question, reorder steps or restyle the whole thing in the Collectform editor, hit Publish, and your site shows the new version on the next page load. Your Next.js code doesn't change.
- No commit, no pull request, no build
- Marketers can change the form without a developer
- One form stays in sync on every page it's embedded on
Meta and TikTok server-side tracking, with consent built in
Most Next.js contact forms stop at sending an email. Collectform also tells Meta and TikTok who converted, with no tracking code in your repo.
Server-side tracking, without the wiring
Paste your pixel ID and access token in the Integrations tab. Events reach the Meta Conversions API and the TikTok Events API from the server, so they still arrive when a browser pixel gets blocked. Emails and phone numbers are SHA-256 hashed first, and Pixel and server events share an event ID so Meta counts each conversion once.
Cookie consent, built in
Turn on one setting and the form shows its own consent banner. The Meta Pixel and all Meta and TikTok events are held until the visitor accepts. If they reject, nothing goes to Meta or TikTok, and you still get their submission.
Next.js forms for more than your contact page
These are real multi-step forms you can preview right here. Pick one, make it yours in the editor, and embed it with the same 2 lines.
Build it yourself, or ship it today
A Next.js contact form is a small job until it needs everything around it.
Hand-built form
- A Route Handler or Server Action to write and maintain
- Validation and error states to code by hand
- Multi-step state and branching logic to manage in React
- An email provider to set up and monitor
- A commit and redeploy for every field change
- Pixel, Conversions API, hashing and dedup to wire up
- A consent banner and tracking gates to build
Collectform
- Hosted backend, nothing to maintain
- Required field, email and phone validation included
- Multi-step flows and conditional logic, with no code
- Email alerts for your team, plus optional auto-replies
- Edits go live when you hit Publish
- Meta and TikTok server-side tracking built in
- Consent banner built in, one setting to turn on
Simple pricing that pays for itself
Your campaigns scale, your bill doesn't. A month of collectform costs less than one wasted lead.
Features
- 300 leads/month
- 10 active forms
- 50k CAPI requests/month
- advanced field matching
- 1 seat
Features
- 1000 leads/month
- 25 active forms
- unlimited CAPI requests
- advanced field matching
- 5 seats
Next.js contact form FAQ
The fastest way is to embed a hosted form instead of building one. With Collectform you build the form in a no-code editor, then add 2 lines to your page (plus the next/script import): a Script tag that loads the embed and a collectform-embed element with your form ID. Setup takes about 5 minutes, with no API route, Server Action or email provider to configure.
To build one by hand, create a form component, handle the submit in a Server Action or Route Handler, validate the input on the server with a library like Zod, and send the message with an email tool like Resend or Nodemailer. That works well for a simple form in a codebase you're happy to maintain. Collectform is for when you also want no-code edits, multi-step logic and ad tracking without building them.
Yes. Collectform forms run one question per step, with conditional logic that changes the path based on each answer. You build the steps in the no-code editor and embed the whole flow with the same 2 lines, so there's no step state to manage in React. An optional setting also saves progress, so visitors can come back and continue where they left off.
Yes. Collectform is a standard web component loaded with next/script, which both routers support. In the App Router it works inside a Server Component, so you don't need "use client". It also works on any host, including Vercel and Netlify, because the form runs in the browser.
Yes. TypeScript doesn't know about custom elements by default, so add the small collectform.d.ts file shown in the TypeScript tab above. You only add it once, and it also type-checks the form-id attribute.
No. The embed loads your published form each time the page loads, so your changes appear on the next page load after you hit Publish in the Collectform editor. There's no commit and no build, and marketers can make changes without a developer.
Every submission is saved in your Collectform dashboard. You can also get an email alert for each one, send the visitor an automatic reply, and POST each submission to your own endpoint with a webhook.
Yes. Collectform sends events to the Meta Conversions API and the TikTok Events API from the server, and can fire the Meta Pixel in the browser too. You paste your pixel ID and access token in the Integrations tab, so there's no tracking code in your repo. Emails and phone numbers are SHA-256 hashed before they're sent, and Pixel and server events share an event ID so Meta counts each conversion once.
Yes. Turn on the Cookie consent setting and the form shows its own consent banner. The Meta Pixel and all Meta and TikTok events are held until the visitor accepts. If they reject, nothing is sent to Meta or TikTok and you still receive their submission. The banner covers the form's own tracking, and your page can listen for the collectform:consent browser event to gate any other pixels you run.
No. The form renders inside a Shadow DOM, so your Tailwind classes don't reach inside it and its styles stay out of your app. You style it from the Design tab in the editor, with your own colors, fonts and corner radius.
Yes. The same 2 lines work for any form you build in Collectform, including quote requests, consultation bookings, lead magnets, webinar registrations and multi-step surveys. Start from a template or a blank form and embed it on any page.
Every plan starts with a 7-day trial and no credit card. After that, Pro is $29/month, or $20/month billed yearly, and includes 300 leads/month and 10 active forms. Team is $59/month, or $40/month billed yearly, and includes 1000 leads/month and 25 active forms.
Ship your Next.js contact form today
Build your multi-step form without code, paste 2 lines and hit Publish. Edit it whenever you like, with Meta and TikTok tracking and cookie consent already in place.
7-day trial · No credit card · From $20/mo, billed yearly