---
title: "@supertokens-plugins/captcha-react"
description: "Public root exports for @supertokens-plugins/captcha-react 0.3.1."
---

**Package version:** `0.3.1`

Generated from the packed release's root declaration, `./dist/index.d.ts`. Only exports reachable from that root are
listed. See the [immutable release source](https://github.com/supertokens/supertokens-plugins/blob/%40supertokens-plugins%2Fcaptcha-react%400.3.1/packages/captcha-react/src/index.ts).

## Public root exports

| Export | Kind |
| --- | --- |
| `default` | Constant |
| `init` | Constant |
| `PLUGIN_ID` | Constant |
| `SuperTokensPluginCaptchaConfig` | Type |
| `useCaptcha` | Function |
| `useCaptchaInputContainer` | Function |

## `default`

Published from the emitted `_default` declaration.

Root export:

```ts check=false reason="Generated API signature"
export { PLUGIN_ID, type SuperTokensPluginCaptchaConfig, _default as default, init, useCaptcha, useCaptchaInputContainer };
```

Resolved declaration:

```ts check=false reason="Generated API signature"
import * as supertokens_auth_react_lib_build_types from 'supertokens-auth-react/lib/build/types';
declare const _default: {
    init: (config: SuperTokensPluginCaptchaConfig) => supertokens_auth_react_lib_build_types.SuperTokensPlugin;
};
```

## `init`

Root export:

```ts check=false reason="Generated API signature"
export { PLUGIN_ID, type SuperTokensPluginCaptchaConfig, _default as default, init, useCaptcha, useCaptchaInputContainer };
```

Resolved declaration:

```ts check=false reason="Generated API signature"
import { SuperTokensPlugin } from 'supertokens-auth-react/lib/build/types';
declare const init: (config: SuperTokensPluginCaptchaConfig) => SuperTokensPlugin;
```

## `PLUGIN_ID`

Root export:

```ts check=false reason="Generated API signature"
export { PLUGIN_ID, type SuperTokensPluginCaptchaConfig, _default as default, init, useCaptcha, useCaptchaInputContainer };
```

Resolved declaration:

```ts check=false reason="Generated API signature"
declare const PLUGIN_ID = "supertokens-plugin-captcha";
```

## `SuperTokensPluginCaptchaConfig`

Root export:

```ts check=false reason="Generated API signature"
export { PLUGIN_ID, type SuperTokensPluginCaptchaConfig, _default as default, init, useCaptcha, useCaptchaInputContainer };
```

Resolved declaration:

```ts check=false reason="Generated API signature"
type SuperTokensPluginCaptchaConfig = CaptchaConfig & {
    InputContainer?: React.ForwardRefExoticComponent<CaptchInputContainerProps & React.RefAttributes<HTMLDivElement>>;
    inputContainerId?: string | (() => Promise<string>);
};
```

## `useCaptcha`

Root export:

```ts check=false reason="Generated API signature"
export { PLUGIN_ID, type SuperTokensPluginCaptchaConfig, _default as default, init, useCaptcha, useCaptchaInputContainer };
```

Resolved declaration:

```ts check=false reason="Generated API signature"
declare function useCaptcha(onError?: (error: string) => void): {
    state: CaptchaState;
    load: (configOverride?: Partial<SuperTokensPluginCaptchaConfig>) => Promise<true | undefined>;
    render: () => Promise<void>;
    containerId: string | (() => Promise<string>);
};
```

## `useCaptchaInputContainer`

Root export:

```ts check=false reason="Generated API signature"
export { PLUGIN_ID, type SuperTokensPluginCaptchaConfig, _default as default, init, useCaptcha, useCaptchaInputContainer };
```

Resolved declaration:

```ts check=false reason="Generated API signature"
import * as react from 'react';
declare function useCaptchaInputContainer(): react.ForwardRefExoticComponent<{
    form: "EmailPasswordSignInForm" | "EmailPasswordSignUpForm" | "EmailPasswordResetPasswordEmail" | "EmailPasswordSubmitNewPassword" | "PasswordlessEmailForm" | "PasswordlessPhoneForm" | "PasswordlessEmailOrPhoneForm" | "PasswordlessEPComboEmailForm" | "PasswordlessEPComboEmailOrPhoneForm" | "PasswordlessUserInputForm";
} & react.HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
```

## Required signature types

These declarations are not additional package-root exports. They are included because the public signatures above depend on them.

### `CaptchaConfig`

```ts check=false reason="Generated API signature"
type CaptchaConfig = {
    type: "reCAPTCHAv3";
    captcha: ReCAPTCHAv3Config;
} | {
    type: "reCAPTCHAv2";
    captcha: ReCAPTCHAv2Config;
} | {
    type: "turnstile";
    captcha: TurnstileConfig;
};
```

### `CaptchaState`

```ts check=false reason="Generated API signature"
type CaptchaState = {
    error: string | undefined;
    token: string | undefined;
    isLoading: boolean;
    isRendering: boolean;
};
```

### `CaptchInputContainerProps`

```ts check=false reason="Generated API signature"
type CaptchInputContainerProps = {
    form: "EmailPasswordSignInForm" | "EmailPasswordSignUpForm" | "EmailPasswordResetPasswordEmail" | "EmailPasswordSubmitNewPassword" | "PasswordlessEmailForm" | "PasswordlessPhoneForm" | "PasswordlessEmailOrPhoneForm" | "PasswordlessEPComboEmailForm" | "PasswordlessEPComboEmailOrPhoneForm" | "PasswordlessUserInputForm";
} & React.HTMLAttributes<HTMLDivElement>;
```

### `ReCAPTCHAv2Config`

```ts check=false reason="Generated API signature"
type ReCAPTCHAv2Config = ReCaptchaV2.Parameters;
```

### `ReCAPTCHAv3Config`

```ts check=false reason="Generated API signature"
type ReCAPTCHAv3Config = {
    /**
     * Your sitekey.
     */
    sitekey: string;
    /**
     * The name of the action. Actions may only contain alphanumeric characters and slashes, and must not be user-specific.
     */
    action?: string;
};
```

### `TurnstileConfig`

```ts check=false reason="Generated API signature"
type TurnstileConfig = Turnstile.RenderParameters;
```
