Turnstile Initializer
turnstile renders a Cloudflare Turnstile captcha and writes the solved token into a hidden form input. It backs the <x-captcha> component and follows the page locale and light/dark theme.
Enable it
You don't enable this by hand — render the <x-captcha> component, which adds init="turnstile", loads the Cloudflare script, and supplies the site key. Only render it when a site key is configured:
blade
@if (setting('cloudflare_turnstile_site_key'))
<x-captcha :title="__('Captcha')" name="captcha" />
@endifOnce solved, the token is submitted with the form and validated server-side with the captcha rule. See Asset & Init System for how the init attribute is wired.
Options
The site key, theme, and language are filled from the page automatically. Pass extra Turnstile rendering options as captcha- attributes (note: the prefix is captcha-, not turnstile-):
captcha-action— an action label sent with the challenge.captcha-size— widget size (flexibleby default).captcha-retry-interval— delay (ms) before automatically retrying a failed challenge.
blade
<x-captcha name="captcha" captcha-action="login" />Related
- Captcha component — the component that enables this for you.
- Theming — the light/dark mode the widget follows.
- Asset & Init System — the
initattribute and how widgets are wired.