formkit-honeypot

A Vue component for stopping spam. Use with FormKit
2,083
Install
npm install formkit-honeypot
Latest Version:0.0.11
Vue:3
Last Updated:Sep 14, 2024
Links: npm
Maintainer: danielkellyio

FormKit HoneyPot

Prevent spam in your Vue.js + FormKit applications.

Learn how honeypot fields work

npm i formkit-honeypot vue @formkit/vue
<script setup lang="ts">
  import { ref } from 'vue'
  import FormKitHoneypot from 'formkit-honeypot'

  const honeypot = ref<InstanceType<typeof FormKitHoneypot>>()
  // const honeypot = useTemplateRef() (Vue 3.5 +)

  function formHandler(form) {
    if (!honeypot.value?.isSpam()) {
      // submit the form only for humans
    }

    // show your confirmation to bots and people alike
  }
</script>

<template>
  <FormKit type="form" @submit="formHandler">
    <!-- Other legit fields here...-->
    <FormKitHoneypot name="website" ref="honeypot" />
  </FormKit>
</template>

Props

  • name - should be something bots are tempted to fill in (not something they'd want to avoid like "honeypot") - defaults to website. If you are collecting a "website" field on your form for real, you'll want to change this, otherwise the default is fine.

  • ref - not really a prop. Enables template refs. See Vue docs for more info

Related Packages

unocss-preset-formkit

A UnoCSS preset for FormKit variants.

31,951
@formkit/inertia

FormKit + Inertia = ❤️

74,315 12
@sfxcode/nuxt-primevue

* Load PrimeVue Components * Add PrimeVue Services (usePrimeDataTable) * Formkit...

3,199

Version History

Version Released Vue License
0.0.11 ^3.4.29
0.0.10 ^3.4.29
0.0.9 ^3.4.29
0.0.8 ^3.4.29
0.0.7 ^3.4.29