![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@semantic-components/re-captcha
Advanced tools
**@semantic-components/re-captcha** is an Angular library designed to simplify the integration of Google reCAPTCHA into your Angular applications. It supports reCAPTCHA v2 and v3, providing an easy-to-use API and seamless setup for enhancing your app's se
@semantic-components/re-captcha is an Angular library designed to simplify the integration of Google reCAPTCHA into your Angular applications. It supports reCAPTCHA v2 and v3, providing an easy-to-use API and seamless setup for enhancing your app's security.
This library is compatible only with Angular 19.
If you are using a different version of Angular, please upgrade to Angular 19 before using this library.
To install the library, use npm or yarn:
npm install @semantic-components/re-captcha
or
yarn add @semantic-components/re-captcha
To use reCAPTCHA v2 provide the v2SiteKey
and to use reCAPTCHA v3 provide the v3SiteKey
using the provideScReCaptchaSettings
function:
...
import { provideScReCaptchaSettings } from '@semantic-components/re-captcha';
export const appConfig: ApplicationConfig = {
providers: [
...
provideScReCaptchaSettings({
v2SiteKey: 'YOUR_V2_SITE_KEY',
v3SiteKey: 'YOUR_V3_SITE_KEY',
languageCode: 'fr',
}),
],
};
In your component template, add the reCAPTCHA v2 to a div:
<form [formGroup]="checkboxReCaptchaForm" (ngSubmit)="onSubmit()">
<div sc-checkbox-re-captcha [siteKey]="siteKey" formControlName="captcha"></div>
<button type="submit">Submit</button>
</form>
In your component class:
import { Component } from '@angular/core';
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
import { ScCheckboxReCaptcha } from '@semantic-components/re-captcha';
@Component({
selector: 'app-root',
imports: [ReactiveFormsModule, ScCheckboxReCaptcha],
templateUrl: './app.component.html',
styleUrl: './app.component.css',
})
export class AppComponent {
siteKey = 'YOUR_V2_SITE_KEY'; //You can also provide it globally with provideScReCaptchaSettings
checkboxReCaptchaForm = new FormGroup({
captcha: new FormControl(''),
});
onSubmit() {
console.log(this.form.value);
}
}
In your component template, add the invisible reCAPTCHA v2 to a button (you can also add it to a div):
<button [callback]="myCallback" sc-invisible-re-captcha>
Click me to execute Invisible reCAPTCHA
</button>
In your component class:
import { Component } from '@angular/core';
import { ScInvisibleReCaptcha } from '@semantic-components/re-captcha';
@Component({
selector: 'app-root',
imports: [ScInvisibleReCaptcha],
templateUrl: './app.component.html',
styleUrl: './app.component.css',
})
export class AppComponent {
myCallback = (token: string) => {
console.log('Callback function:', token);
};
}
Call the execute function programmatically before submitting the form
In your component template, add a button to execute reCAPTCHA v3 :
<button (click)="executeReCaptcha()">Execute reCAPTCHA V3</button>
In your component class:
import { Component, inject } from '@angular/core';
import { ScScoreReCaptcha } from '@semantic-components/re-captcha';
@Component({
selector: 'app-root',
imports: [],
templateUrl: './app.component.html',
styleUrl: './app.component.css',
})
export class AppComponent {
private readonly scScoreReCaptcha = inject(ScScoreReCaptcha);
async executeReCaptcha() {
const token = await this.scScoreReCaptcha.execute('action-name');
console.log('Token:', token);
}
}
This library is licensed under the MIT License. See the LICENSE file for details.
FAQs
**@semantic-components/re-captcha** is an Angular library designed to simplify the integration of Google reCAPTCHA into your Angular applications. It supports reCAPTCHA v2 and v3, providing an easy-to-use API and seamless setup for enhancing your app's se
The npm package @semantic-components/re-captcha receives a total of 276 weekly downloads. As such, @semantic-components/re-captcha popularity was classified as not popular.
We found that @semantic-components/re-captcha demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.