A simple contact form example using Next.js and Formbase.
Formbase is a form backend service that handles form submissions for you. No server code needed - just point your form to Formbase and receive submissions via email or webhooks.
-
Clone this repository:
git clone https://github.com/formbase-dev/formbase-nextjs-example.git cd formbase-nextjs-example -
Install dependencies:
bun install
-
Configure your Form ID:
- Sign up at formbase.dev and create a form
- Copy your Form ID
- Open
src/components/ContactForm.tsxand replaceYOUR_FORM_IDwith your actual Form ID
-
Start the development server:
bun run dev
- User fills out the contact form (name, email, message)
- On submit, the form data is POSTed to
https://formbase.dev/s/{YOUR_FORM_ID} - Formbase processes the submission and sends you a notification
- User is redirected to a thank-you page
├── src/
│ ├── app/
│ │ ├── thank-you/
│ │ │ └── page.tsx # Success page after submission
│ │ ├── globals.css # Tailwind CSS
│ │ ├── layout.tsx # Root layout
│ │ └── page.tsx # Home page with contact form
│ └── components/
│ └── ContactForm.tsx # Form component with loading state
├── public/
├── package.json
├── next.config.ts
└── tsconfig.json
Add new input fields in ContactForm.tsx:
<div>
<label htmlFor="phone">Phone</label>
<input type="tel" id="phone" name="phone" />
</div>This project uses Tailwind CSS. Modify the classes on any element to change its appearance.
- Next.js - Full-stack React framework
- React - UI library
- TypeScript - Type safety
- Tailwind CSS - Styling
- Formbase - Form backend service
- Formbase Documentation
- Other Formbase Examples
MIT