rcc
react-client-captcha
npm i react-client-captcha
rcc

react-client-captcha

A light JS-based captcha generator.

by Majid Amiri

1.0.3 (see all)License:MITTypeScript:Not Found
Categories:React Captcha
npm i react-client-captcha
Readme

react-client-captcha

npm version Codecov Build Status

A light JS-based captcha generator.

  • Custom characters.
  • Retry functionality.
  • Easily customizable via props.

Documentation

Installation

npm install react-client-captcha --save
or
yarn add react-client-captcha

Usage

Edit react-client-captcha

import React from "react";
import ReactDOM from "react-dom";
import ClientCaptcha from "react-client-captcha";

export default class App extends React.Component {
  render() {
    return <ClientCaptcha captchaCode={code => console.log(code)} />;
  }
}

ReactDOM.render(<App />, document.getElementById("app"));

Props

NameDescriptionTypeDefault
widthwidth of captcha image.number100
heightheight of captcha image.number40
fontSizefontSize of captcha characters.number22
fontFamilyfontFamily of captcha characters.string"Arial, Tahoma"
fontColorfontColor of captcha characters.string"#000"
charscharacters that captcha should be made with.string"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
charsCountcount of characters that captcha should be made with.number4
captchaCodefunction that returns current shown captcha code.func
backgroundColorbackgroundColor of captcha image.string"#F2F2F2"
retrywhether captcha has retry functionalitybooltrue
retryIconthe icon of retry buttonstring"https://cdn.jsdelivr.net/npm/react-client-captcha/dist/retry.svg"
retryIconSizesize of retry button iconnumber24
retryButtonClassNameclassName of retry buttonstringcssClasses.retryButton
retryImgClassNameclassName of retry imgstring""
containerClassNameclassName of captcha and retry button container divstringcssClasses.captchaContainer
captchaClassNameclassName of captcha imagestring""

Tests

Clone the project and run yarn test

License

MIT © Majid Amiri