# react-netlify-forms

> React components and hooks giving you the power of Netlify Forms. Start building serverless forms on Netlify with React.

Latest version **2.0.3** (published 2025-06-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-netlify-forms
pnpm add react-netlify-forms
yarn add react-netlify-forms
bun add react-netlify-forms
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2025-06-20 |
| First published | 2020-06-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 1 |
| Unpacked size | 67 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Björn Clees <piranhadev@gmail.com> (https://github.com/pyrax/) |
| Maintainers | pyrax |
| Keywords | react, netlify, forms, netlify-forms, react-netlify-form, react-netlify-forms |

## Links

- npm: https://www.npmjs.com/package/react-netlify-forms
- Repository: Pyrax/react-netlify-forms
- Homepage: https://pyrax.github.io/react-netlify-forms
- Issues: https://github.com/pyrax/react-netlify-forms/issues
- npm.io page: https://npm.io/package/react-netlify-forms

## Dependencies (1)

- [react-google-recaptcha](https://npm.io/package/react-google-recaptcha.md) ^2.1.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.0.3 (latest) — 2025-06-20
- 2.0.2 — 2025-06-20
- 2.0.1 — 2025-06-13
- 2.0.0 — 2025-06-09
- 1.3.3 — 2022-09-01
- 1.3.2 — 2021-06-18
- 1.3.1 — 2021-05-11
- 1.3.0 — 2021-04-07
- 1.2.0 — 2020-09-01
- 1.1.0 — 2020-06-19
- 1.0.0 — 2020-06-19

## README

# react-netlify-forms

> React components and hooks giving you the power of Netlify Forms. Start building serverless forms on Netlify with React. Honeypot fields and reCAPTCHA are included as ready-to-use components.

[![NPM Version](https://img.shields.io/npm/v/react-netlify-forms)](https://www.npmjs.com/package/react-netlify-forms)
[![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-netlify-forms)](http://bundlephobia.com/package/react-netlify-forms)
[![Checked with Biome](https://img.shields.io/badge/Checked_with-Biome-60a5fa?&logo=biome)](https://biomejs.dev)

[Go to documentation with live demo.](https://pyrax.github.io/react-netlify-forms)

## Features

It gives you all the features of Netlify Forms as simple and **reusable** React components which have been tested on Netlify.

- Default form handlers with support for file uploads.
- Spam prevention through included honeypot and reCAPTCHA components.
- Can be used alone or together with form libraries such as Formik or react-hook-form.

## Before using

This component must be used with Server-Side Rendering (SSR) because Netlify
searches for a `data-netlify` attribute on HTML `form` tags to setup their
Forms backend for you.

_Suggestions: Astro, Next.js, Remix or Vite_

## Install

```bash
npm install --save react-netlify-forms
```

## Usage

In the following example a contact form with two inputs and a honeypot for extra spam prevention is shown. It also works without JavaScript by falling back to a serverside-rendered form which just submits data with an usual POST request:

```jsx
import React from 'react'
import { NetlifyForm, Honeypot } from 'react-netlify-forms'

const ContactForm = () => (
  <NetlifyForm name='Contact' action='/thanks' honeypotName='bot-field'>
    {({ handleChange, success, error }) => (
      <>
        <Honeypot />
        {success && <p>Thanks for contacting us!</p>}
        {error && (
          <p>Sorry, we could not reach our servers. Please try again later.</p>
        )}
        <div>
          <label htmlFor='name'>Name:</label>
          <input type='text' name='name' id='name' onChange={handleChange} />
        </div>
        <div>
          <label htmlFor='message'>Message:</label>
          <textarea
            type='text'
            name='message'
            id='message'
            rows='4'
            onChange={handleChange}
          />
        </div>
        <div>
          <button type='submit'>Submit</button>
        </div>
      </>
    )}
  </NetlifyForm>
)

export default ContactForm
```

For more examples please browse through our website.

## License

MIT © [Björn Clees](https://github.com/Pyrax)

## Acknowledgements

Thanks to [create-react-library](https://www.npmjs.com/package/create-react-library) for providing quick setup for NPM packages.

---
_Source: https://npm.io/package/react-netlify-forms · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
