๐ A modern, lightweight Angular CAPTCHA library featuring multiple verification challenges. Perfect for securing login forms, registration pages, and any application requiring human verification.
- ๐งฎ Math CAPTCHA - Arithmetic challenges with dynamic difficulty
- ๐๏ธ Slider CAPTCHA - Interactive position matching
- ๐ข Pattern CAPTCHA - Memory-based sequence challenges
- ๐ฑ Fully Responsive - Optimized for all screen sizes
- ๐จ Customizable Sizes - Small & medium size variants
- โก Zero Dependencies - Self-contained with inline SVG icons
- ๐ง TypeScript First - Complete type definitions included
- ๐ Smart Refresh - Automatic and manual challenge regeneration
- โจ๏ธ Keyboard Friendly - Enter key support and accessibility features
- ๐ฏ Compact Design - Minimal footprint for tight layouts
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms'; import { NgxNumericCaptchaModule } from 'ngx-numeric-captcha';
@NgModule({ declarations: [AppComponent], imports: [ BrowserModule, FormsModule, // Required for form controls NgxNumericCaptchaModule ], bootstrap: [AppComponent] }) export class AppModule { }
isCaptchaVerified = false; CaptchaType = CaptchaType;
onCaptchaResult(result: CaptchaResult) { this.isCaptchaVerified = result.isValid; }
if (result.isValid) { console.log('โ CAPTCHA verified successfully!'); } else { console.log('โ Verification failed. Attempts:', result.attempts); }
Property | Type | Default | Description |
---|---|---|---|
type |
CaptchaType |
'math' |
The type of CAPTCHA challenge |
size |
'small' | 'medium' |
'small' |
Component size variant |
Event | Type | Description |
---|---|---|
captchaResult |
CaptchaResult |
Fired when user attempts verification |
enum CaptchaType { MATH = 'math', SLIDER = 'slider', PATTERN = 'pattern' }
interface CaptchaResult { isValid: boolean; // Whether verification was successful attempts: number; // Number of attempts made }
Simple arithmetic challenges perfect for quick verification.
<ngx-numeric-captcha type="math" size="small" (captchaResult)="handleMath($event)">
Features:
- Addition, subtraction, and multiplication
- Numbers optimized for compact display (1-15)
- Enter key submission support
- Auto-generates new problems on failure
Interactive position matching for engaging user experience.
<ngx-numeric-captcha type="slider" size="medium" (captchaResult)="handleSlider($event)">
Features:
- Visual target indicator
- Configurable tolerance zone
- Smooth drag interaction
- Mobile-friendly touch support
Memory-based sequence challenges for enhanced security.
<ngx-numeric-captcha type="pattern" size="small" (captchaResult)="handlePattern($event)">
Features:
- 3-number sequence challenges
- Visual sequence display
- Grid-based input interface
- Clear/reset functionality
export class LoginComponent { email = ''; password = ''; isCaptchaVerified = false;
onCaptchaResult(result: CaptchaResult) { this.isCaptchaVerified = result.isValid;
if (!result.isValid && result.attempts >= 3) {
// Handle max attempts reached
console.warn('Max verification attempts reached');
}
}
onLogin() { if (this.isCaptchaVerified) { // Proceed with secure login this.authService.login(this.email, this.password); } } }
Please verify you're human to continue
<lib-compact-captcha type="slider" size="medium" (captchaResult)="onVerification($event)">
<button
[disabled]="!isCaptchaVerified || !comment.trim()"
(click)="submitComment()">
Post Comment
</button>
ngx-numeric-captcha { --captcha-primary-color: #4CAF50; --captcha-secondary-color: #2196F3; --captcha-error-color: #F44336; --captcha-border-radius: 8px; --captcha-font-family: 'Inter', sans-serif; }
๐ฑ Responsive Behavior The component automatically adjusts for different screen sizes:
Desktop: Full feature set with hover effects
Tablet: Touch-optimized interactions
Mobile: Compact layout with larger touch targets
โฟ Accessibility ARIA labels for screen readers
Keyboard navigation support
High contrast compatible
Focus indicators for all interactive elements
Alternative text for visual elements
๐ Browser Support Browser Version Chrome 90+ Firefox 88+ Safari 14+ Edge 90+ iOS Safari 14+ Chrome Mobile 90+
๐ Performance Bundle size: ~15KB (minified + gzipped)
Runtime overhead: Minimal
Memory usage: <1MB typical
Zero external dependencies
๐ Version Compatibility ngx-numeric-captcha Angular Node.js 1.x 17+ 18+