npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

secure-react-captcha

v1.0.1

Published

React Secure Captcha is a powerful and customizable npm package designed to seamlessly integrate secure and user-friendly CAPTCHA functionality into your React application.

Downloads

26

Readme

SecureReactCaptcha

SecureReactCaptcha is a React component that provides an easy way to add secure CAPTCHA functionality to your web forms. CAPTCHAs are commonly used to prevent automated bot submissions on web applications.

Features

  1. CAPTCHA Generation: SecureReactCaptcha provides a simple and efficient way to generate CAPTCHA images, which are commonly used to prevent automated bot submissions on web forms.

  2. Customizable CAPTCHA: You can customize the CAPTCHA generation process by specifying options such as the inclusion of noise dots and curved lines, as well as adjusting the quantity of dots and lines.

  3. User Validation: The component offers user validation by comparing the entered CAPTCHA text with the generated CAPTCHA image. It provides feedback to the parent component through the setValidated callback.

  4. Auto Reset: The CAPTCHA can be reset easily by clicking the provided "Reset" button, generating a new CAPTCHA image and clearing the user-entered text.

  5. Flexible Character Set: You can define a custom character set for the CAPTCHA text, allowing you to include specific characters or limit the character set to your requirements.

  6. Accessibility: The component is designed to be accessible and can be used in compliance with accessibility guidelines for web applications.

  7. Easy Integration: Integrating the SecureReactCaptcha component into your React application is straightforward, making it a convenient choice for adding CAPTCHA functionality to forms.

  8. Clean Styling: The component provides basic styling, and you can further customize its appearance by applying your CSS styles to match your application's design.

  9. User-Friendly: It enhances the user experience by providing a visual challenge-response test without the need for users to decipher complex characters.

  10. Open Source: The component is open-source and can be freely used and extended in your projects. You can also contribute to its development and improvement.

These features collectively make the SecureReactCaptcha component a valuable tool for securing your web forms against automated bot submissions while ensuring a user-friendly experience for your website visitors.

Installation

You can install SecureReactCaptcha using npm or yarn:

npm install secure-react-captcha
# or
yarn add secure-react-captcha

Styling the Component

import the stylesheet to your index.js file:

import 'secure-react-captcha/styles/style.css'

Usage


import React, { useState } from 'react';

import SecureReactCaptcha from 'secure-react-captcha';

function App() {
  const [validated, setValidated] = useState(false);

  const handleValidation = (isValid) => {
    setValidated(isValid);
  };

  const submitForm = e => {
    e.preventDefault();
    if(validated){
      // do submit your form here...
    }else{
      // show error message
    }
  }

  return (
    <div>
      <h1>Secure Form</h1>
      <form onSubmit={submitForm}>
        {/* Your other form fields here */}

        {/* Place the captcha component here */}

        <SecureReactCaptcha
          setValidated={handleValidation}
        />

        {/* Your submit button here */}
        <button type="submit">Submit</button>
      </form>
    </div>
  );
}

export default App;

Props

  • setValidated (function, required): A callback function that will receive a boolean value indicating whether the entered CAPTCHA text is valid.

  • needDots (boolean, optional, default: true): Whether to include noise dots in the CAPTCHA image.

  • needLines (boolean, optional, default: true): Whether to include curved lines in the CAPTCHA image.

  • minDots (number, optional, default: 400): Minimum number of noise dots in the CAPTCHA image.

  • maxDots (number, optional, default: 500): Maximum number of noise dots in the CAPTCHA image.

  • minLines (number, optional, default: 10): Minimum number of curved lines in the CAPTCHA image.

  • maxLines (number, optional, default: 100): Maximum number of curved lines in the CAPTCHA image.

  • characters (string, optional, default: "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"): The set of characters to be used in the CAPTCHA text.

Custom Styling the Component

if you want to write the styles of your own, use the following format:


/* Container for the entire ReactSecureCaptcha component */
.src_container {
    /* Your styles for the container */

    &:hover {
        /* Styles on hover */
    }

    &:focus {
        /* Styles on focus */
    }
}

/* Container for the captcha canvas and reset button */
.src_canvas_container {
    /* Your styles for the container */

    &:hover {
        /* Styles on hover */
    }

    &:focus {
        /* Styles on focus */
    }
}

/* The captcha canvas element */
.src_canvas {
    /* Your styles for the canvas */

    &:hover {
        /* Styles on hover */
    }

    &:focus {
        /* Styles on focus */
    }
}

/* The reset button for generating a new captcha */
.src_reset_button {
    /* Your styles for the reset button */

    &:hover {
        /* Styles on hover */
    }

    &:focus {
        /* Styles on focus */
    }
}

/* The input field for entering captcha text */
.src_input {
    /* Your styles for the input field */

    &:hover {
        /* Styles on hover */
    }

    &:focus {
        /* Styles on focus */
    }
}

and then import your css file to index.js file instead of the default css file.

License

This component is released under the MIT License. See LICENSE for details.

Issues

If you encounter any issues or have suggestions for improvements, please open an issue on the Github Repository.

Author

Contributors

We welcome contributions from the community. If you'd like to contribute to this project, please fork the repository and submit a pull request.