Vue library for Cloudflare Turnstile CAPTCHA alternative
npm install vue-turnstile
A Cloudflare Turnstile library for Vue 3
Add vue-turnstile to your Javascript project dependencies using Yarn:
``bash`
yarn add vue-turnstile
Or NPM:
`bash`
npm install vue-turnstile --save
`vue
Token: {{ token }}
`
| Prop | Type | Description | Required | Default |
| --------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ---------- |
| site-key | String | Your Turnstile sitekey - Docs | Yes | N/A |String
| v-model | | Binding that contains the token returned by the Turnstile widget | Yes | N/A |Number
| reset-interval | | Get a fresh token after reset-interval milliseconds - Turnstile tokens only last for 5 minutes | No | 295000 |'normal' \| 'flexible' \| 'compact'
| size | | Widget size | No | 'normal' |'light' \| 'dark' \| 'auto'
| theme | | Widget theme - auto respects the user's browser preference | No | 'auto' |String
| action | | A customer value that can be used to differentiate widgets under the same sitekey in analytics and which is returned upon validation. | No | '' |'always' \| 'execute' \| 'interaction-only'
| appearance | | Appearance controls when the widget is visible - Docs | No | 'always' |Boolean
| render-on-mount | | Automatically render Turnstile widget after component mounts | No | true |String
| language | | Language to display - ISO 639-1 two-letter language code - Supported languages | No | auto |
| Method | Description |
| ---------- | ------------------ |
| reset() | Resets the widget |render()
| | Renders the widget |
| Method | Params | Description |
| ------------------------ | ------- | ------------------------------------------------------------------------------------- |
| @error | code | Callback invoked when there is an error (e.g. network error or the challenge failed). |@unsupported
| | - | Callback invoked when a given client/browser is not supported by Turnstile. |@expired
| | - | Callback invoked when the token expires and does not reset the widget. |@before-interactive
| | - | Callback invoked before the challenge enters interactive mode. |@after-interactive` | - | callback invoked when challenge has left interactive mode. |
|
Rui Gomes
https://ruigomes.me
The MIT License (MIT). Please see LICENSE file for more information.