Integrations · Frameworks and SDKs

Form guard for React, Vue, Svelte, Webflow, Framer and Shopify

The form guard is one script tag. This page adds it the way your site is built: a component for React, Vue or Svelte, or a paste-in for Webflow, Framer and Shopify themes. Each one loads the same script from https://email-validation.org/guard/, with the same options, so it behaves exactly as the form guard page describes: it looks at an email field when the visitor has finished with it, offers a one-click fix for typos, stops the form only for the results you choose (invalid and disposable by default) and lets every submission through when something goes wrong.

Before you start

Create a key just for the site under API keys in the dashboard, as in Set it up: only the Validate addresses permission, your site's addresses as allowed origins (add the address you test on, such as your webflow.io, framer.website or myshopify.com address), and a daily credit cap. The key sits in your page's source, so treat it as public: what a browser key protects.

Test with the free test addresses: no_mailbox@sandbox.email-validation.org shows the message and stops the form, likely_typo@sandbox.email-validation.org also offers a fix, and accepted@sandbox.email-validation.org goes through. Do not send a form with a test address that goes through where its sign-up gets an email (a confirmation, a welcome, a newsletter): test addresses receive no mail, and the bounce hurts your sending.

The files

Download them as one zip: email-validation-form-guard-1.0.0.zip. It unpacks into a folder form-guard/, with the components in src/ and the Webflow, Framer and Shopify paste-ins in snippets/.

Settings

SettingOn the tagWhat it does
browserKeydata-keyYour browser key.
region: 'eu'data-region="eu"Sends the checks to https://api-eu.email-validation.org (EU data residency). Set it on every component of the page: the script reads it once, when it loads.
stopdata-stopThe results that stop the form: any of invalid, disposable, catch_all; [] (or none) stops nothing and shows no result message (typo fixes only).
auto: falsedata-auto="off"Guards only fields marked data-ev-guard.
messagesdata-msg-invalid, data-msg-disposable, data-msg-catch-all, data-msg-suggestYour own wording.
pinned: truethe frozen URLLoads this version's frozen file with Subresource Integrity.
onVerdictthe ev-guard eventEach change of a field's verdict: address, status, stop, message, suggestion, error.

The script is one per page, so its settings are page-wide: give every component on a page the same ones. Once loaded, it guards every email field on the page, also outside the component and on the other routes of a single-page app, until the visitor leaves. Put data-ev-guard="off" on your log-in and password forms (or use auto: false and mark the fields to guard with data-ev-guard), so a customer whose address no longer checks out can still sign in. A page that enforces Trusted Types adds ev-form-guard to its trusted-types directive.

React

React 18 or 19, Next.js and Remix included. Copy core.ts and react.ts from the zip's src/ folder (the files) into one folder of your app.

import { FormGuard } from './form-guard/react';

<FormGuard browserKey="YOUR_BROWSER_KEY">
  <form action="/signup" method="post">
    <input type="email" name="email" />
    <button>Sign up</button>
  </form>
</FormGuard>

Nothing runs during server rendering, strict mode and route changes load the script once, and an unmounted form is no longer guarded. If your app sends the form from a click handler, await check(field) there (check comes from react.ts too) and go on unless stop is true.

Vue

Vue 3.3 or later, Nuxt included. Copy core.ts and vue.ts from the zip's src/ folder (the files) into one folder of your app.

<FormGuard browser-key="YOUR_BROWSER_KEY" @verdict="onVerdict">
  <form action="/signup" method="post">
    <input type="email" name="email" />
  </form>
</FormGuard>

Svelte

Svelte 5, SvelteKit included (the use:formGuard action also works in Svelte 4). Copy core.ts, svelte.ts and FormGuard.svelte from the zip's src/ folder (the files) into one folder of your app.

<FormGuard browserKey="YOUR_BROWSER_KEY">
  <form action="/signup" method="post">
    <input type="email" name="email" />
  </form>
</FormGuard>

Webflow

Webflow runs custom code only when the site has a paid site plan or sits in a Core, Growth, Agency or Freelancer workspace; without one, the snippet below cannot be used, even on the site's webflow.io address.

  1. In Webflow, open Site settings → Custom code and paste this into Footer code, with your key in place of YOUR_BROWSER_KEY:

    <script src="https://email-validation.org/guard/v1.js" data-key="YOUR_BROWSER_KEY" defer></script>
  2. Save and publish the site. Webflow runs custom code on the published site; in the Designer it runs only in Preview with Enable custom code turned on, on a canvas.webflow.com address that your key's allowed origins would also need, so test on the published site.

  3. Test it on the published site with the test addresses above.

Every field of the Email type is guarded. To leave a form alone, give it the custom attribute data-ev-guard with the value off (the form's Element settings → Custom attributes). If you already use the Webflow check, use one of the two, not both.

Framer

  1. In Framer, open Assets → Code, create a code file named FormGuard, and replace its contents with the contents of snippets/framer/FormGuard.tsx from the files.
  2. Drag FormGuard onto each page that has a form. On the canvas it shows a small label; on the published site it is invisible.
  3. In its properties, paste your key into Browser key and choose what stops the form.
  4. Publish, and test on the published site.

If you already use the Framer check, use one of the two, not both.

Shopify themes

For Online Store 2.0 themes such as Dawn. It guards the theme's newsletter, contact and create-account forms, never the log-in or password forms.

  1. In your Shopify admin, open Online Store → Themes, then … → Edit code on your theme.
  2. Under Sections, choose Add a new section, name it ev-form-guard, replace its contents with the contents of snippets/shopify/ev-form-guard.liquid from the files, and Save.
  3. Choose Customize, then in the Footer, Add section → Email form guard.
  4. Paste your key into Browser key, choose the forms and what stops them, and Save.

Checkout and Shopify's own customer account pages are not part of your theme, so they are not guarded. To check the customers your shop already has, see Shopify.

The integrations on this page

Updated · Maintained by: Email Validation LLC

Need help? Contact support, or ask the help chat. Something wrong or missing on this page? Tell us