1.0.14 • Published 3 months ago

react-canvas-captcha v1.0.14

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

React Canvas Captcha

Add captcha to your react projects

React Captcha Image

Installation

  npm install react-canvas-captcha

OR

  yarn add react-canvas-captcha

Usage

import Captcha from "react-canvas-captcha";

const App = () => {
  const [generatedCaptcha, setGeneratedCaptcha] = useState('');

  return (
    <Captcha
      boxHeight={50}
      boxWidth={130}
      refreshButton
      captchaConfig={{
        numberOfChars: 4,
        font: "bold 23px Arial",
        textStartingX: 15,
        textStartingY: 5,
      }}
      setCode={(captchaCode) => setGeneratedCaptcha(captchaCode)}
    />
  );
};

export default App;

Parameters

Parameter NameDefault ValueDescription
boxHeight50Height of the canvas box
boxWidth130Width of the canvas box
refreshButtonfalseShow or hide the refresh button. To show the refresh button make this "true"
caseTypemixUse caseType to make the captcha code case sensitive or use mix. options (mix, uppercase, lowercase)
captchaConfig{ numberOfChars: 4, font: 'bold 23px Arial', textStartingX: 15, textStartingY: 5 }Config for the box. Set the number of characters usinng prop "numberOfChars". Use "font" to set the font styling. Use "textStartingX" to set the horizontal starting point for characters inside the box. Use "textStartingY" to set the vertical starting point for characters inside the box.
setCodeUse this function to get the new captcha code
1.0.14

3 months ago

1.0.9

4 months ago

1.0.11

4 months ago

1.0.10

4 months ago

1.0.13

4 months ago

1.0.12

4 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago