React & Next.js
Embed a Formfacade form in a React or Next.js app with the @formfacade/embed-react component β with props for prefill, submit, and load callbacks.
Quick Answer
How do I embed a Formfacade form in React or Next.js?
Install @formfacade/embed-react, import the FormfacadeEmbed component, and pass your form's embed URL as formFacadeURL. Optional props handle prefill (prefillForm), submit (onSubmitForm), and load (onFormLoad). In Next.js App Router, render it in a Client Component.
For React and Next.js apps, Formfacade ships a dedicated component so the form
renders as a first-class part of your app β no raw <script> tag needed.
Watch the walkthrough
Install
npm i @formfacade/embed-react
Get your form's embed URL
In the Formfacade interface, open Share β Embed and choose Embed in my React.js web app. Copy the formFacadeURL it gives you β it looks like:
https://formfacade.com/include/<your-id>/form/<your-form-id>/classic.js?div=ff-compose
Basic usage
import React from "react";
import FormfacadeEmbed from "@formfacade/embed-react";
const FORMFACADE_URL =
"https://formfacade.com/include/<your-id>/form/<your-form-id>/classic.js?div=ff-compose";
export default function ContactForm() {
return <FormfacadeEmbed formFacadeURL={FORMFACADE_URL} />;
}
Props
| Prop | Type | Required | What it does |
|---|---|---|---|
formFacadeURL | string | Yes | Your form's embed URL (from Share β Embed) |
onSubmitForm | function | No | Called when the form is submitted |
onFormLoad | function | No | Called when the form finishes loading |
prefillForm | function | No | Returns a map of entry.<id> β value to prefill |
flush | boolean | No | Disables autosave when true |
Full example (prefill + callbacks)
import React from "react";
import FormfacadeEmbed from "@formfacade/embed-react";
const FORMFACADE_URL =
"https://formfacade.com/include/<your-id>/form/<your-form-id>/classic.js?div=ff-compose";
export default function App() {
const prefillForm = () => ({
"entry.1297600622": "@formfacade/embed-react",
"entry.813617742": `${new Date()}`,
});
const onSubmitForm = () => console.log("----FORM SUBMITTED----");
const onFormLoad = () => console.log("----FORM LOADED----");
return (
<FormfacadeEmbed
formFacadeURL={FORMFACADE_URL}
prefillForm={prefillForm}
onSubmitForm={onSubmitForm}
onFormLoad={onFormLoad}
flush={true}
/>
);
}
Next.js App Router
FormfacadeEmbed renders on the client, so in the Next.js App Router put it in
a Client Component β add "use client"; at the top of the file that uses
it (or of a small wrapper component you import into your server page).
Finding entry IDs for prefill
The entry.<id> keys in prefillForm are your Google Form's field IDs β the
same ones Google Forms uses in its own pre-filled links.
Next steps
- Prefer plain HTML? See Choosing Your Platform.
- See where submissions go and how to stream them to a sheet in How Responses Sync.