Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hcaptcha/vue3-hcaptcha

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hcaptcha/vue3-hcaptcha

hCaptcha Component Library for Vue.js. Compatible with Vue 2 and 3.

  • 1.0.0-alpha.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

Vue.js hCaptcha Component Library

hCaptcha Component Library for Vue.js. Compatible with Vue 2 and 3.

Installation

You can install this library via npm with:

  • vue2: npm install @hcaptcha/vue-hcaptcha --save
  • vue3: npm install @hcaptcha/vue3-hcaptcha --save

or via yarn:

  • vue2: yarn add @hcaptcha/vue-hcaptcha
  • vue3: yarn add @hcaptcha/vue3-hcaptcha

or via script tag (Vue must be globally available)

  • vue2
    <script src="https://unpkg.com/vue"></script>
    <script src="https://unpkg.com/@hcaptcha/vue-hcaptcha"></script>
    
  • vue3
    <script src="https://unpkg.com/vue@next"></script>
    <script src="https://unpkg.com/@hcaptcha/vue3-hcaptcha"></script>
    
Basic Usage
  • vue2:

    <template>
        <vue-hcaptcha sitekey="**Your sitekey here**"></vue-hcaptcha>
    </template>
    
    <script>
      import VueHcaptcha from '@hcaptcha/vue-hcaptcha';
      export default {
        ...
        components: { VueHcaptcha }
      };
    </script>
    
  • vue3:

    <template>
        <vue-hcaptcha sitekey="**Your sitekey here**"></vue-hcaptcha>
    </template>
    
    <script setup>
      import VueHcaptcha from '@hcaptcha/vue-hcaptcha';
    </script>
    

The component will automatically load the hCaptcha API library and append it to the root component.

JS API

Props
NameValues/TypeRequiredDefaultDescription
sitekeyStringYes-Your sitekey. Please visit hCaptcha and sign up to get a sitekey.
sizeString (normal, compact, invisible)NonormalThis specifies the "size" of the checkbox. hCaptcha allows you to decide how big the component will appear on render. Defaults to normal.
themeString (light, dark)NolighthCaptcha supports both a light and dark theme. If no theme is set, the API will default to light.
tabindexIntegerNo0Set the tabindex of the widget and popup. When appropriate, this can make navigation of your site more intuitive.
languageString (ISO 639-2 code)NoautohCaptcha auto-detects language via the user's browser. This overrides that to set a default UI language.
reCaptchaCompatBooleanNotrueDisable drop-in replacement for reCAPTCHA with false to prevent hCaptcha from injecting into window.grecaptcha.
challengeContainerStringNo-A custom element ID to render the hCaptcha challenge.
rqdataStringNo-See Enterprise docs.
sentryBooleanNo-See Enterprise docs.
apiEndpointStringNo-See Enterprise docs.
endpointStringNo-See Enterprise docs.
reportapiStringNo-See Enterprise docs.
assethostStringNo-See Enterprise docs.
imghostStringNo-See Enterprise docs.
Callback Events
EventParamsDescription
errorerrWhen an error occurs. Component will reset immediately after an error.
verifytoken, eKeyWhen challenge is completed. The token and an eKey are passed along.
expired-When the current token expires.
challenge-expired-When the unfinished challenge expires.
opened-When the challenge is opened.
closed-When the challenge is closed.
reset-When the challenge is reset.
rendered-When the challenge is rendered.
executed-When the challenge is executed.

Methods

MethodDescription
execute()Programmatically trigger a challenge request
reset()Reset the current challenge

FAQ

How can I get a sitekey?

Sign up at hCaptcha to get your sitekey. Check documentation for more information.

What is hCaptcha?

hCaptcha is a drop-in replacement for reCAPTCHA that earns websites money and helps companies get their data labeled.

Are features like bot scores and No-CAPTCHA/passive mode also available?

Yes, in the enterprise version: see hCaptcha Enterprise (BotStop) for details.

Demo

Demo

To run the demo:

  1. clone this repo git clone https://github.com/hCaptcha/vue-hcaptcha.git
  2. cd examples/traditional-vue2
  3. yarn && yarn serve
    • it will start the demo app on localhost:8080
    • open your console to see the demo app emitting events

TypeScript

TypeScript is supported (types/index.d.ts), and you can see an example by running npm run serve:ts.

Notes for developers

Scripts
  • yarn lint - will check for lint issues
  • yarn test - will test both vue2 and vue3 packages
  • yarn build - will build the production vue2,3 versions

Notes for maintainers

Publishing

To publish a new version, follow the next steps:

  1. Bump the version of the updated package: vue2/package.json or vue3/package.json
  2. Push changes to master.

FAQs

Package last updated on 19 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc