@saithwaqasali/captcha
v1.0.5
Published
A modern, lightweight CAPTCHA component for React and Next.js
Maintainers
Readme
@saithwaqasali/captcha
A modern, lightweight CAPTCHA component for React and Next.js projects. Easily integrate human verification in your forms with a simple, responsive UI.
Features
- Lightweight and easy to integrate
- Fully typed with TypeScript
- React 17+ and Next.js compatible
- Built-in refresh functionality
- CSS modules for scoped styling
- Callback on CAPTCHA validation
Installation
Using Yarn
yarn add @saithwaqasali/captchaUsing NPM
npm install @saithwaqasali/captchaUsage
import React from "react";
import { Captcha } from "@saithwaqasali/captcha";
export default function App() {
return (
<div>
<h1>Sign Up Form</h1>
<Captcha
onValidate={(success) => {
if (success) {
console.log("CAPTCHA passed!");
} else {
console.log("CAPTCHA failed. Try again.");
}
}}
/>
</div>
);
}Props
| Prop | Type | Description |
| ------------ | ---------------------------- | ---------------------------------------------------------------------------------- |
| onValidate | (success: boolean) => void | Callback fired on CAPTCHA submission. Returns true if correct, false otherwise |
