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.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
40K
increased by19.48%
Maintainers
1
Weekly downloads
 
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)}
    />
  );
}

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 *
idstringid of the div
classNamestringpassed to the div
styleobjectpassed to the div

And the following callbacks:

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

* responseField and responseFieldName are experimental and not yet documented.

** onExpire is called when the Turnstile challenge expires without creating a token.

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

FAQs

Package last updated on 22 Oct 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