solid-grecaptcha
Version:
> Package based on [solid-hcaptcha](https://github.com/Vexcited/solid-hcaptcha) using g-recaptcha of google
57 lines (40 loc) • 1.86 kB
Markdown
> Package based on [solid-hcaptcha](https://github.com/Vexcited/solid-hcaptcha) using g-recaptcha of google
Sign up at [g-rcaptcha](https://www.google.com/recaptcha/) to get your sitekey today. **You need a sitekey to use this library.**
1. [Installation](
2. [Implementation](
3. [References](
```bash
npm install solid-grecaptcha
yarn add solid-grecaptcha
```
```tsx
import GRecaptcha from "solid-grecaptcha";
const App: Component = () => {
return (
<GRecaptcha
sitekey=""
onVerify={token => console.log(token)}
/>
);
};
export default App;
```
| Name | Values/Type | Required | Default | Description |
| ---- | ----------- | -------- | ------- | ----------- |
| `sitekey` | `string` | **Yes** | `-` | This is your sitekey, this allows you to load captcha. If you need a sitekey, please visit g-recaptcha, and sign up to get your sitekey. |
| `size` | `"normal" \| "compact"` | No | `"normal"` | This specifies the "size" of the component. g-recaptcha allows you to decide how big the component will appear on render, this always defaults to normal. |
| `theme` | `"light" \| "dark"` | No | `"light"` | g-recaptcha supports both a light and dark theme. If no theme is inherently set, the captcha will always default to light. |
| `tabindex` | `number` | No | `0` | Set the tabindex of the widget and popup. When appropriate, this can make navigation of your site more intuitive. |
| Name | Params | Description |
| ---- | ----------- | -------- |
| `onVerify` | `token:string`| Executed when user submits a successful response |
| `onError` | `-`| Executed when recaptcha find an error |
| `onExpire` | `-`| Executed when response expires and the user needs to re-verify |