How-to · Funnels, Websites & Forms

How to Embed a GoHighLevel Form in a React or Next.js Site

Pasting HighLevel's embed code into React doesn't work as-is because scripts in JSX don't run. Here is a component that renders the form iframe and loads the resize script properly.

What you'll do

  • HighLevel's form embed code has two parts: an iframe and a script.
  • In React, render the iframe as JSX and load the script once with an effect or your framework's script component.
  • Use the form's own URL in the iframe so submissions reach your sub-account.
  • The same approach works for HighLevel surveys and calendars.

To embed a GoHighLevel form in React, take the form's embed code, render its iframe as JSX, and load HighLevel's embed script once in a useEffect (or with your framework's script component, such as Next.js's Script). Pasting the raw embed code into JSX doesn't work because script tags inside JSX don't execute, which is why forms often appear cut off or blank.

Before you start

  • A finished HighLevel form with the right fields and consent. See building forms.
  • The form's embed code from its share or integrate options. Note the iframe src, id, any data- attributes, and the script URL.
  • A React project (Create React App, Vite, Next.js, or an AI-built site) you can edit.
  • Basic familiarity with components and hooks.

What the embed code contains

PartPurposeReact handling
iframeDisplays the hosted formRender as JSX with converted attributes
data- attributes and idTell the script how to size and behaveKeep exactly as provided
script tagResizes the iframe and handles embed behavioursLoad once via effect or script component

Build the component

  1. Create a component file, for example HighLevelForm.jsx.
  2. Convert the iframe to JSX. Change class to className, turn the style string into a JavaScript object with camelCase keys (width 100%, height 100%, border none, and so on), and keep id, src, title, and every data- attribute unchanged. Why: the script uses the id and data attributes to find and size the frame.
  3. Load the script in an effect. Inside useEffect, check whether a script with the same src already exists in the document; if not, create a script element, set its src to the URL from the embed code, set async, and append it to document.body. Why: loading it once avoids duplicate listeners when the component re-renders or remounts.
  4. Wrap the iframe in a container with a sensible minimum height, so the layout doesn't jump before the script resizes it.
  5. Use the component on your contact page.

In Next.js

Render the iframe in a client component and load the script with next/script using an after-interactive strategy, or use the same useEffect approach inside a component marked as client-side. Avoid rendering the script in a server component, where it won't behave as expected.

The exact script URL and attributes come from your form's embed code and can change when HighLevel updates its embeds. Always copy fresh code from your account rather than from an old project or tutorial.

Pass hidden values

To record where a lead came from, add hidden fields to the HighLevel form, then append matching query parameters to the iframe's src (for example a UTM source). Check HighLevel's help center for how your form maps URL parameters to hidden fields, and test that the value lands on the contact.

Alternative: your own form plus webhook or API

If you need a fully custom React form, you can send submissions to a workflow's Inbound Webhook trigger or HighLevel's API. You then own validation, consent capture, and spam protection, and you should keep any API keys on a server, never in front-end code. The Integrations and API tutorials cover API access, which requires the Unlimited plan or above.

Test it

  1. Load the page and confirm the form displays at full height with no inner scroll bar.
  2. Navigate away and back (client-side routing) and confirm it still displays correctly.
  3. Submit with test details and confirm the contact appears in HighLevel.
  4. Check the browser console for errors.
  5. Test on a phone.

Common mistakes

  • Pasting the script tag into JSX, where it never runs.
  • Changing or removing the iframe id, so resizing fails.
  • Loading the script on every render, causing duplicate behaviour.
  • Exposing API keys in a custom front-end form.
  • Using a form from the wrong sub-account.

What to build next

Frequently asked questions

How do I integrate a GoHighLevel form into a React website?

Copy the form's embed code, convert the iframe to JSX (className, style objects, camelCase attributes), and load the embed script once with useEffect or a framework script component. Submissions go straight to HighLevel.

Why does the embedded form get cut off?

The resize script isn't loading or isn't finding the iframe. Make sure the script loads after the iframe renders and keep the iframe's id and data attributes from the original embed code.

Can I post to HighLevel from my own React form instead?

Yes, using HighLevel's API or an inbound webhook, but you then build validation, consent, and spam protection yourself. The embedded form is simpler and keeps HighLevel's form features.

Does this work with Lovable or other AI-built React sites?

Yes, AI site builders that output React can use the same component. Paste it in or describe it to the builder, then test a submission.