1.0.3 • Published 5 years ago

react-client-captcha v1.0.3

Weekly downloads
176
License
MIT
Repository
github
Last release
5 years ago

react-client-captcha

npm version Codecov Build Status

npm.io

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

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago