You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-smart-captcha

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-smart-captcha

A professional customizable React Captcha component with Canvas and Math modes, animations with Framer Motion, and toast notifications via Sonner.

1.0.1
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
0
Weekly downloads
 
Created
Source

react-smart-captcha

A highly customizable React Captcha component featuring multiple captcha types including Canvas and Math modes, smooth animations powered by Framer Motion, and user-friendly toast notifications via Sonner.

Features

  • Canvas Captcha with customizable text, noise, colors, and fonts.
  • Math Captcha presenting simple arithmetic questions.
  • Smooth animations for captcha refresh and error feedback using Framer Motion.
  • Toast notifications for success and error messages with Sonner.
  • Fully configurable props for maximum flexibility.
  • Supports auto-validation or manual validation modes.
  • Lightweight, TypeScript-based and ready for production.
  • Accessible with proper ARIA attributes.

Installation

Install the package and its peer dependencies:

npm install react-smart-captcha framer-motion sonner

Usage Example

"use client";

import React from "react";
import { Captcha } from "react-smart-captcha";
import { Toaster } from "sonner";

export default function CaptchaExample() {
  const handleValidation = (isValid: boolean) => {
    console.log("Captcha valid?", isValid);
  };

  return (
    <>
      <Toaster />
      <Captcha
        type="canvas"
        length={6}
        onValidate={handleValidation}
        placeholder="Enter captcha here"
      />
    </>
  );
}

Props

PropTypeDescriptionDefault
type"canvas" | "math"Captcha type (Canvas text captcha or Math question)"canvas"
lengthnumberNumber of characters in the captcha (Canvas only)6
widthnumberWidth of the captcha display180
heightnumberHeight of the captcha display50
fontSizenumberFont size for the captcha text28
fontFamilystringFont family for captcha text"Arial"
backgroundColorstringBackground color of captcha"#f9f9f9"
textColorstringText color for captcha"#333"
noisenumberAmount of noise (dots) on Canvas Captcha30
placeholderstringInput field placeholder text"Enter captcha"
errorMessagestringError message shown on invalid captcha"Invalid captcha"
successMessagestringSuccess message shown on valid captcha"Captcha valid"
autoValidatebooleanAutomatically validate input on complete inputtrue
animationDurationnumberDuration of animations in seconds0.4
onValidate(isValid: boolean) => voidCallback fired after validation, with success statusundefined

License

This project is licensed under the MIT License.

Keywords

react

FAQs

Package last updated on 26 Jul 2025

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.