1.1.6 • Published 11 months ago

@josh256/vue-turnstile v1.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Owner

https://github.com/gaviti/vue-turnstile

I just forked it to add action prop to the component.

Vue Turnstile

A Vue 3.3.x component wrapper for Cloudflare's Turnstile

Installation

NPM

npm install @josh256/vue-turnstile

Yarn

yarn add @josh256/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

PropTypeDescriptionRequiredDefault
site-keyStringYour Turnstile sitekey - DocsYesN/A
theme'light' \| 'dark' \| 'auto'Widget themeNo'auto'
size'normal' \| 'compact'Widget sizeNo'normal'
auto-resetBooleanAllow to refresh the token after some time (in milliseconds)Nofalse
reset-timeoutNumberRefresh the token after some time (in milliseconds) * requires auto-reset to be trueNo295000
recaptcha-compatBooleanAdds recaptcha compatibility layerNofalse
explicit-renderBooleanRenders the widget explicitlyNofalse
appearance'always' \| 'execute' \| 'interaction-only'Appearance controls when the widget is visible - DocsNoalways
LanguageStringLanguage to display - ISO 639-1 two-letter language code - Supported languagesNoauto
actionStringA customer value that can be used to differentiate widgets under the same sitekey in analytics and which is returned upon validation - DocsNo

Methods

MethodDescription
render()Render the widget
reset()Reset the widget
remove()Remove the widget
getToken()Generates a new token

Events

NameParamsDescription
@verifiedReturns the token
@renderingEmitted on mounted (returns nothing)
@renderedEmitted at the end of render (returns nothing)
@errorcodeCallback invoked when there is an error (e.g. network error or the challenge failed).

Slots

NameDescription
defaultDefault slot

License

MIT License

Copyright (c) 2025 josh256

1.1.6

11 months ago

1.1.5

11 months ago