Skip to content

Reference

Initializes state and functions with useNetlifyForm and provides them with a context with <NetlifyFormProvider/>. Renders a form using <NetlifyFormComponent/> inside the context.

Available props:

NameReqDescription
childrenYChildren rendered inside the form like inputs.
formPropsNAdditional props for the <NetlifyFormComponent/>. Can be used to override default methods like onSubmit and onReset.
propsNPassed as arguments to useNetlifyForm for setting options for the Netlify Form.

Hook used by <NetlifyForm /> to create handlers and state which are used inside the form context.

Available props:

NameReqDescription
nameYName of the form.
actionYForm action to fallback to when JavaScript is disabled.
honeypotNameNNeeded when a honeypot is used because SSR needs to know it in advance.
enableRecaptchaNSet this if reCAPTCHA is used because SSR needs to know it in advance.
onSuccessNHandler when data has been submitted to Netlify.
onFailureNHandler when Netlify sent an error.

Providing values to NetlifyFormContext.

Available props:

NameReqDescription
childrenYChildren of context.
propsYContext values.

Form context which exposes form state, handlers and actions for consumers.

For an usage example have a look at Contact form example.

Hook-based variant for consuming <NetlifyFormContext />.

Renders a form with handlers provided by NetlifyFormContext.

Available props:

NameReqDescription
ChildrenYForm content like inputs.
propsYAdditional props passed to the form. Can be used to override default methods like onSubmit and onReset.

Component to create a honeypot field which provides extra spam prevention. If a bot fills this field, Netlify dismisses the submitted form data.

Available props:

NameReqDescription
labelNLabel as text before honeypot field.
propsNAdditional props for input of the honeypot.

In Netlify dashboard you have to set SITE_RECAPTCHA_KEY and SITE_RECAPTCHA_SECRET. Also, make sure to provide SITE_RECAPTCHA_KEY to the reCAPTCHA component on the client using siteKey-prop.

Available props:

NameReqDescription
siteKeyYRecaptcha public site key.
invisibleNSet whether reCAPTCHA should be invisible or not.
(any)NAny other prop will be passed through to the underlying component.