pittica/gatsby-plugin-recaptcha

License Version Release GitHub package.json dependency version (dev dep on branch) GitHub package.json dependency version (dev dep on branch)

Description

ReCaptcha component for GatsbyJS.

This plugin has been developed using GatsbyJS tutorials.

Install

npm

npm install @pittica/gatsby-plugin-recaptcha

Usage

Import the component classes.

import ReCaptcha, { Loader } from "@pittica/gatsby-plugin-recaptcha"

The component works better in React.Component objects.

export default class ContactPage extends React.Component {
  constructor(props, context) {
    Loader()
  }

  verifyCallback = (token) => {
  }

  render() {
    return (
      <ReCaptcha
        action="homepage"
        sitekey="RECAPTCHA_PUBLIC_KEY"
        callback={this.verifyCallback}
      />
    )
  }
}

Attributes

The components has some attributes.

sitekey

  • Type: string
  • Required: yes

ReCaptcha public key.

action

  • Type: string
  • Required: yes

ReCaptcha action. Common values are homepage or login.

id

  • Type: string
  • Required: no

HTML ID for multiple ReCaptcha elements.

badge

  • Type: string
  • Required: no
  • Values: bottomright, bottomleft, inline
  • Default value: inline

Badge position and aspect.

size

  • Type: string
  • Required: no
  • Values: compact, normal, invisible
  • Default value: invisible

Badge size.

callback

  • Type: function
  • Required: no

Validation callback.

(c) 2020, Pittaca S.r.l.s.