lara-light-indigo

Captcha

Captcha is a form validation component based on Recaptcha.

Import via Module

import { Captcha } from 'primereact/captcha';
 
Import via CDN

<script src="https://unpkg.com/primereact/core/core.min.js"></script>
<script src="https://unpkg.com/primereact/captcha/captcha.min.js"></script>
 
Getting Started

Captcha is used with a siteKey and a callback to verify the response.


<Captcha siteKey="YOUR_SITE_KEY" onResponse={showResponse}></Captcha>
 
Verification

In order to ensure if a response token is valid, verification against recaptcha api needs to be done at backend. Read more at official documentation.


const showResponse = (response) => {
//call to a backend to verify against recaptcha with private key
}
 

In addition, include the captcha widget resource to your page.


<script src="https://www.google.com/recaptcha/api.js?render=explicit" async defer></script>
 
Properties
NameTypeDefaultDescription
idstringnullUnique identifier of the element.
siteKeystringnullPublic sitekey.
themestringlightThe color scheme of the widget.
typestringimageThe type of CAPTCHA to serve.
sizestringnormalThe size of the widget.
tabIndexnumber0The tabIndex of the widget and challenge.
languagestringenLanguage of the widget.
Events
NameParametersDescription
onResponseevent.response: The user response token.The callback function to be executed when the user submits a successful CAPTCHA response.
onExpire-The callback function to be executed when the recaptcha response expires and the user needs to solve a new CAPTCHA.
Methods
NameParametersDescription
reset-Resets the reCAPTCHA widget.
getResponse-Gets the response for the reCAPTCHA widget.
Accessibility

This section is under development. After the necessary tests and improvements are made, it will be shared with the users as soon as possible.

Dependencies

Google Recaptcha V2

Component Scale

Input Style

Ripple Effect

Free Themes

Built-in component themes created by the PrimeReact Theme Designer.

Bootstrap
Blue
Purple
Blue
Purple
Material Design
Indigo
Deep Purple
Indigo
Deep Purple
Material Design Compact
Indigo
Deep Purple
Indigo
Deep Purple
Tailwind
Tailwind Light
Fluent UI
Blue
PrimeOne Design - 2022 NEW
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
PrimeOne Design - 2021
Saga Blue
Saga Green
Saga Orange
Saga Purple
Vela Blue
Vela Green
Vela Orange
Vela Purple
Arya Blue
Arya Green
Arya Orange
Arya Purple
Premium Themes

Premium themes are only available exclusively for PrimeReact Theme Designer subscribers and therefore not included in PrimeReact core.

Soho Light
Soho Dark
Viva Light
Viva Dark
Mira
Nano

Legacy Free Themes

Nova
Nova Alt
Nova Accent
Luna Blue
Luna Green
Luna Amber
Luna Pink
Rhea

Premium Create-React-App Templates

Beautifully crafted premium create-react-app application templates by the PrimeTek design team.

Sakai
Atlantis
Freya
Ultima
Diamond
Sapphire
Serenity
Babylon
Avalon
Apollo
Roma