NextJS Guide
Add A Contact Form To NextJs
Here is guide for integrating Fabform with a Next.js site:
Step 1: Create a new Next.js site
If you don’t have a Next.js site set up yet:
-
Create Next.js App: Run the following command to create a new Next.js app. You’ll be prompted to name your app:
-
Navigate to Your App: Move into the newly created app directory:
-
Start Development Server: Launch the Next.js development environment:
Next.js will start a hot-reloading development environment accessible at http://localhost:3000/
.
Step 2: Add a Contact Section to your Next.js site
-
Create Contact Page: Inside the
pages
directory of your Next.js app, create a new JavaScript file namedcontact.js
. -
Update Contact Page Content: Replace the content of
contact.js
with the following code block:Note: Replace
{your-form-endpoint}
with the unique form endpoint provided by Fabform.
Step 3: Run your Next.js site locally to finalize setup
-
Start Next.js Development Server: Run the following command to see your Next.js form in action at
localhost:3000/contact/
: