0.0.2 ā€¢ Published 2 years ago

solid-turnstile v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

solid-turnstile

šŸ” A very simple Solid library for Cloudflare Turnstile. Inspired by react-turnstile

release npm npm license sponsor

Installation

pnpm add solid-turnstile

Demo

https://xhofe.github.io/solid-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 *

Add others props to <div /> element.

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.

0.0.2

2 years ago

0.0.1

2 years ago