A lightweight and declarative Cloudflare Turnstile integration for Svelte and SvelteKit.
Live playground: battlefieldduck.github.io/turnstile-svelte
npm install @battlefieldduck/turnstile-svelte
<script lang="ts">
import { turnstile } from '@battlefieldduck/turnstile-svelte';
function callback(token: string) {
console.log('Challenge Success:', token);
}
</script>
<div {@attach turnstile({ sitekey: '1x00000000000000000000AA', callback })}></div>
Contributions are welcome! Please feel free to submit pull requests or open issues.
turnstile-svelte is licensed under the MIT License. See the LICENSE
file for more details.