JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 633715
  • Score
    100M100P100Q180676F
  • License MIT

TypeScript definitions for react-google-recaptcha

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@types/react-google-recaptcha) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Installation

    npm install --save @types/react-google-recaptcha

    Summary

    This package contains type definitions for react-google-recaptcha (https://github.com/dozoisch/react-google-recaptcha).

    Details

    Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-google-recaptcha/v0.

    index.d.ts

    import * as React from "react";
    
    export default ReCAPTCHA;
    
    declare class ReCAPTCHA extends React.Component<ReCAPTCHAProps> {
        /**
         * Resets the reCAPTCHA widget
         */
        reset(): void;
        /**
         * Programatically invoke the reCAPTCHA check. Used if the invisible reCAPTCHA is on a div instead of a button
         */
        execute(): void;
    
        /**
         * Gets the response for the reCAPTCHA widget.
         * @return the response of the reCAPTCHA widget.
         */
        getValue(): string | null;
    
        /**
         * Gets the widgetId of reCAPTCHA widget
         * @return widgetId | null
         */
        getWidgetId(): number | null;
    }
    
    type Theme = "light" | "dark";
    type Type = "image" | "audio";
    type Size = "compact" | "normal" | "invisible";
    type Badge = "bottomright" | "bottomleft" | "inline";
    
    export interface ReCAPTCHAProps {
        /**
         *  The API client key
         */
        sitekey: string;
        /**
         *  The function to be called when the user successfully completes the normal or compat captcha.
         *     It will also be called with null, when captcha expires
         *  @param token string or null
         */
        onChange?: ((token: string | null) => void) | undefined;
        /**
         *  Optional light or dark theme of the widget
         *  @default "light"
         */
        theme?: Theme | undefined;
        /**
         * Optional image or audio The type of initial captcha
         * @default "image"
         */
        type?: Type | undefined;
        /**
         *  Optional the tabindex of the element
         *  @default 0
         */
        tabindex?: number | undefined;
        /**
         *  Optional callback, called when a challenge expires and has to be redone by the user.
         */
        onExpired?: (() => void) | undefined;
        /**
         *  Optional set the stoken parameter, which allows the captcha to be used from different domains,
         *  @see reCAPTCHA secure-token
         */
        stoken?: string | undefined;
        /**
         *  Optional compact, normal or invisible. This allows you to change the size or do an invisible captcha
         */
        size?: Size | undefined;
        /**
         * Optional. The badge location for g-recaptcha with size of "invisible".
         *
         * @default "bottomright"
         */
        badge?: Badge | undefined;
    }
    

    Additional Details

    • Last updated: Wed, 18 Oct 2023 11:45:05 GMT
    • Dependencies: @types/react

    Credits

    These definitions were written by Koala Human, and Tom Sturge.