All frameworks
Next.jsNext.js

Use NBForms with Next.js

Add a working contact form to your Next.js app in minutes. Works with both the App Router and Pages Router — no server actions, no API routes, and no serverless functions to maintain.

Official Next.js docs
Next.js
'use client'
import { useState } from 'react'

export default function ContactForm() {
  const [status, setStatus] = useState('idle')

  async function handleSubmit(e) {
    e.preventDefault()
    setStatus('sending')
    const res = await fetch('https://api.nbforms.com', {
      method: 'POST',
      body: new FormData(e.target),
    })
    const data = await res.json()
    setStatus(res.ok ? 'success' : 'error')
  }

  if (status === 'success') return <p>Thanks — we'll be in touch!</p>

  return (
    <form onSubmit={handleSubmit}>
      <input type="hidden" name="_token" value="YOUR_TOKEN" />
      <label>Name</label>
      <input type="text" name="name" required />
      <label>Email</label>
      <input type="email" name="email" required />
      <label>Message</label>
      <textarea name="message" required />
      <button type="submit" disabled={status === 'sending'}>
        {status === 'sending' ? 'Sending…' : 'Send'}
      </button>
    </form>
  )
}

Why NBForms?

  • Works with App Router and Pages Router
  • No API routes or server actions required
  • Client component ready with "use client" directive
  • Handles redirects, loading states, and errors

Add to your Next.js app in minutes

Free tier included. No credit card. No backend setup — just copy the snippet above and go.

Get started free