Interface
Usage
Pass these options via theoptions prop:
Appearance Options
The theme of the Turnstile widget.
'auto': Respects the user’s system preference'light': Forces light theme'dark': Forces dark theme
The size of the Turnstile widget.Accepted values:
'normal': 300x65px'compact': 150x140px'flexible': 100% width (min: 300px) x 65px'invisible': No visible widget (for invisible type widgets only)
Controls when the widget is visible.
'always': Widget is always visible'execute': Widget only appears when executing'interaction-only': Widget only shown when/if interactivity is required
The language for the widget. Must be a valid ISO 639-1 country code or
'auto'.Examples: 'en', 'es', 'fr', 'de', 'ja', 'zh-CN'See TurnstileLangCode for supported languages.Behavior Options
Controls when to obtain the token.
'render': Obtains token immediately upon render (default)'execute': Obtains token only when.execute()method is called
How to retry on widget failure.
'auto': Automatically allows the user to retry'never': Never allows retry
Duration in milliseconds before the widget automatically retries after a failure.
The refresh mode when a token expires.
'auto': Automatically refreshes the widget'manual': Prompts the user with a refresh button'never': Never refreshes the widget
The refresh mode when the widget times out.
'auto': Automatically refreshes the widget'manual': Prompts the user with a refresh button'never': Never refreshes the widget
Data Options
A customer value used to differentiate widgets under the same sitekey in analytics. Returned upon validation.Useful for tracking which form or page the widget was used on.
Customer payload that can be used to attach customer data to the challenge. Returned upon validation.The data integrity is protected from modifications by attackers.
Form Integration Options
Whether to add a hidden response input element with the Turnstile token.When
true, the token is automatically added as a hidden input in the container.The name of the hidden input element added to the container.
Accessibility Options
The tabindex of Turnstile’s iframe for accessibility purposes.
Allows Cloudflare to gather visitor feedback upon widget failure.
Complete Example
Type Definitions
Related Types
- TurnstileProps - Component props
- Constants - Language codes and other constants