1.0.3 • Published 8 months ago

@miguilim/vue-turnstile v1.0.3

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

vue-turnstile

npm version

A Cloudflare Turnstile library for Vue 3

Installation

Add vue-turnstile to your Javascript project dependencies using Yarn:

yarn add vue-turnstile

Or NPM:

npm install vue-turnstile --save

Usage

<script lang="ts">
import VueTurnstile from 'vue-turnstile';

export default {
  components: { VueTurnstile },

  data() {
    return {
      token: '',
    };
  },
};
</script>

<template>
  <div>
    <vue-turnstile site-key="1x00000000000000000000AA" v-model="token" />
    <div>Token: {{ token }}</div>
  </div>
</template>

Customization options

PropTypeDescriptionRequiredDefault
site-keyStringYour Turnstile sitekey - DocsYesN/A
v-modelStringBinding that contains the token returned by the Turnstile widgetYesN/A
reset-intervalNumberGet a fresh token after reset-interval milliseconds - Turnstile tokens only last for 5 minutesNo295000
size'normal' \| 'compact'Widget sizeNo'normal'
theme'light' \| 'dark' \| 'auto'Widget theme - auto respects the user's browser preferenceNo'auto'
actionStringA customer value that can be used to differentiate widgets under the same sitekey in analytics and which is returned upon validation.No''
render-on-mountBooleanAutomatically render Turnstile widget after component mountsNotrue

Methods

MethodDescription
reset()Resets the widget
render()Renders the widget

Author

Rui Gomes
https://ruigomes.me

License

The MIT License (MIT). Please see LICENSE file for more information.

1.0.3

8 months ago

1.0.2

8 months ago