Turnstile
Cloudflare Turnstile provider for bot protection
About Turnstile
Cloudflare Turnstile is a privacy-first CAPTCHA alternative that verifies users without interactive challenges in most cases. It leverages Cloudflare's global network and threat intelligence to provide seamless bot protection.
For more information, visit the official Cloudflare Turnstile documentation.
Showcase
Usage
import { Turnstile } from "@better-captcha/react/provider/turnstile";
<Turnstile sitekey="1x00000000000000000000AA" options={{}} />import { component$ } from "@builder.io/qwik";
import { Turnstile } from "@better-captcha/qwik/provider/turnstile";
export default component$(() => (
<Turnstile sitekey="1x00000000000000000000AA" options={{}} />
));import { Turnstile } from "@better-captcha/solidjs/provider/turnstile";
<Turnstile sitekey="1x00000000000000000000AA" options={{}} /><template>
<Turnstile
sitekey="1x00000000000000000000AA"
:options="{ theme: 'dark' }"
/>
</template>
<script setup lang="ts">
import { Turnstile } from "@better-captcha/vue/provider/turnstile";
</script><script lang="ts">
import Turnstile from "@better-captcha/svelte/provider/turnstile";
</script>
<Turnstile sitekey="1x00000000000000000000AA" options={{}} />import { Turnstile } from "@better-captcha/lit/provider/turnstile";<turnstile-captcha sitekey="1x00000000000000000000AA"></turnstile-captcha>Configuration
Provider Options
Prop
Type
Imperative Handle
Prop
Type
Testing
Cloudflare provides test keys for development:
| Type | Site Key |
|---|---|
| Always Passes | 1x00000000000000000000AA |
| Always Blocks | 2x00000000000000000000AB |
| Forces Interactive Challenge | 3x00000000000000000000FF |
Test keys are designed for development and automated testing. They will always behave predictably based on the type.
Best Practices
- Invisible by Default: Turnstile is designed to be invisible in most cases - no user interaction needed
- Native Auto Theme: Turnstile natively supports
theme: "auto"- no conversion needed - Lightweight: Turnstile has minimal impact on page load times
- Privacy-First: No tracking or cookies, making it ideal for privacy-conscious applications
- Cloudflare Integration: Works seamlessly with other Cloudflare services