Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-turnstile

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-turnstile

React library for Cloudflare's Turnstile CAPTCHA alternative

  • 1.0.6
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-turnstile

A very simple React library for Cloudflare Turnstile.

Installation

npm i react-turnstile

Usage

import Turnstile from "react-turnstile";

// ...

function TurnstileWidget() {
  return (
    <Turnstile
      sitekey="1x00000000000000000000AA"
      onVerify={(token) => alert(token)}
    />
  );
}

Turnstile tokens expire after 5 minutes, to automatically reset the challenge once they expire, set the autoResetOnExpire prop to true or reset the widget yourself using the onExpire callback.

Documentation

Turnstile takes the following arguments:

nametypedescription
sitekeystringsitekey of your website (REQUIRED)
actionstring-
cDatastring-
themestringone of "light", "dark", "auto"
tabIndexnumber-
responseFieldbooleancontrols generation of <input /> element
responseFieldNamestringchanges the name of <input /> element
retrystringone of "auto", "never"
retryIntervalnumberinterval of retries in ms
autoResetOnExpirebooleanautomatically reset the widget when the token expires
idstringid of the div
refRefcustom react ref for the div
classNamestringpassed to the div
styleobjectpassed to the div

And the following callbacks:

nameargumentsdescription
onVerifytokencalled when challenge is passed (REQUIRED)
onLoadwidgetIdcalled when the widget is loaded
onErrorerrorcalled when an error occurs
onExpire-called when the token expires
onTimeout-called when the challenge expires

For more details on what each argument does, see the Cloudflare Documentation.

FAQs

Package last updated on 25 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc