ReCAPTCHA component accepts various props to customize its appearance and behavior. All props can be passed as standard React component properties.
Required Props
Your Google reCAPTCHA site key. You can obtain this by signing up for an API key pair.
Callback Props
Callback function that is called when the user successfully completes the captcha challenge. Receives the captcha token as a parameter.Default:
() => {}Callback function that is called when the captcha challenge expires and needs to be redone by the user. By default, if not provided, it will call
onChange with null to signify expiration.Callback function that is called when the captcha challenge encounters an error, most likely due to network issues.
Callback function that is called when the Google reCAPTCHA script has been loaded. This is useful for performing actions after the reCAPTCHA API is ready.
This prop is only available when using the default export (wrapper component), not when using the named
ReCAPTCHA export.Appearance Props
The color theme of the widget.Options:
"light" | "dark"Default: "light"The size of the widget. Use
"invisible" for invisible reCAPTCHA which requires manual execution.Options: "compact" | "normal" | "invisible"Default: "normal"Position of the reCAPTCHA badge. Only applies when using
size="invisible".Options: "bottomright" | "bottomleft" | "inline"Default: "bottomright"Interaction Props
The type of captcha challenge to display initially.Options:
"image" | "audio"Default: "image"The tabindex attribute for keyboard navigation.Default:
0Localization Props
Forces the widget to render in a specific language. Uses the hl language code parameter.
Advanced Props
The secure token parameter that allows the captcha to be used from different domains. See Google’s secure token documentation for more information.
Manually provide the grecaptcha object instead of loading it automatically. This is useful when you want to manage the reCAPTCHA script loading yourself.
For plugin owners to not interfere with existing reCAPTCHA installations on a page. If
true, this reCAPTCHA instance will be part of a separate ID space.Default: false