cloudflare-turnstile-widget
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

Cloudflare Turnstile Widget

Framework agnostic widget for Cloudflare's free-to-use CAPTCHA service, Cloudflare Turnstile



Downloads Per Week NPM Version GitHub Build MIT License

[Introduction] [Usage] [Contributors] [License]


Introduction

  • When the requirement is to utilize the Cloudflare's CAPTCHA service in a web component or shadow DOM implementation, Cloudflare's script for their CAPTCHA service only queries the document in the DOM tree which presents a problem that this component solves.
  • The <turnstile-widget> is a custom iframe that makes the use of cloudflare's CAPTCHA easier in your application without the above mentioned issue.

Usage

1️⃣   Install the library in your project.

npm install cloudflare-turnstile-widget

2️⃣   Import the package

import 'cloudflare-turnstile-widget';

3️⃣   Use the widget in your application.

<turnstile-widget site-key="1x00000000000000000000AA" size="compact" theme="dark"></turnstile-widget>

4️⃣   Use event listeners to receive messages from the widget.

document.querySelector('turnstile-widget').addEventListener('success', function (e) {
	console.log(e.detail.content);
});

Contributors

Thanks goes to these wonderful people:

rezo12
rezo12
BOTLANNER
BOTLANNER

License

Licensed under MIT

Based on omni-widget licensed under MIT

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i cloudflare-turnstile-widget

    Weekly Downloads

    87

    Version

    0.3.0

    License

    MIT

    Unpacked Size

    121 kB

    Total Files

    23

    Last publish

    Collaborators

    • rezo12