1.0.8 • Published 3 months ago
@gaviti/vue-turnstile v1.0.8
Vue Turnstile
A Vue 3.3.x component wrapper for Cloudflare's Turnstile
Installation
NPM
npm install @gaviti/vue-turnstile
Yarn
yarn add @gaviti/vue-turnstile
Installation for Vue 2.7.x
For Vue 2.7.x support, you should install a version of this package lower than 1.0.0. Please refer to the "master" branch for the related code.
Usage
<template>
<div>
<vue-turnstile @verified="token = $event" />
<div>Token: {{ token }}</div>
</div>
</template>
<script>
import VueTurnstile from '@gaviti/vue-turnstile';
export default {
components: {
VueTurnstile
},
data() {
return {
token: null,
};
},
};
</script>
Customization options
Prop | Type | Description | Required | Default |
---|---|---|---|---|
site-key | String | Your Turnstile sitekey - Docs | Yes | N/A |
theme | 'light' \| 'dark' \| 'auto' | Widget theme | No | 'auto' |
size | 'normal' \| 'compact' | Widget size | No | 'normal' |
position | 'left' \| 'right' | Widget position (fixed to left or right) | No | undefined |
auto-reset | Boolean | Allow to refresh the token after some time (in milliseconds) | No | false |
reset-timeout | Number | Refresh the token after some time (in milliseconds) * requires auto-reset to be true | No | 295000 |
recaptcha-compat | Boolean | Adds recaptcha compatibility layer | No | false |
explicit-render | Boolean | Renders the widget explicitly | No | false |
appearance | String | Allow to change the appearance | No | always |
Methods
Method | Description |
---|---|
render() | Render the widget |
reset() | Reset the widget |
remove() | Remove the widget |
getToken() | Generates a new token |
Events
Name | Description |
---|---|
@verified | Returns the token |
@rendering | Emitted on mounted (returns nothing) |
@rendered | Emitted at the end of render (returns nothing) |
Slots
Name | Description |
---|---|
default | Default slot |
License
MIT License
Copyright (c) 2024 Gaviti
1.0.8
3 months ago
1.0.7
3 months ago
1.0.6
3 months ago
1.0.5
3 months ago
0.5.2
3 months ago
1.0.4
3 months ago
1.0.3
3 months ago
0.5.1
3 months ago
1.0.2
3 months ago
1.0.1
5 months ago
1.0.0
5 months ago
0.5.0
5 months ago
0.4.3
5 months ago
0.4.2
5 months ago
0.4.1
7 months ago
0.4.0
7 months ago
0.3.3
8 months ago
0.3.2
8 months ago
0.3.1
8 months ago
0.3.0
8 months ago
0.2.3
8 months ago
0.2.2
8 months ago
0.2.1
8 months ago
0.2.0
8 months ago
0.1.10
8 months ago
0.1.9
8 months ago
0.1.8
8 months ago
0.1.7
8 months ago
0.1.6
8 months ago
0.1.5
8 months ago
0.1.4
8 months ago
0.1.3
8 months ago
0.1.2
8 months ago
0.1.0
8 months ago
0.0.8
8 months ago
0.0.7
9 months ago
0.0.6
9 months ago
0.0.5
9 months ago
0.0.4
9 months ago