A simple contact form example using React 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-react-example.git cd formbase-react-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/
│ ├── components/
│ │ └── ContactForm.tsx # Form component with loading state
│ ├── pages/
│ │ ├── Home.tsx # Home page with contact form
│ │ └── ThankYou.tsx # Success page after submission
│ ├── index.css # Tailwind CSS
│ └── main.tsx # App entry point with routing
├── index.html
├── package.json
├── tsconfig.json
└── vite.config.ts
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.
- React - UI framework
- Vite - Build tool
- TypeScript - Type safety
- Tailwind CSS - Styling
- React Router - Client-side routing
- Formbase - Form backend service
- Formbase Documentation
- Other Formbase Examples
MIT