Skip to content

axetroy/react-codebox

Repository files navigation

react-codebox

验证码输入框的 React 实现.

在线 demo

Install

yarn add @axetroy/react-codebox

Usage

import React, { Component } from "react";
import Codebox from "@axetroy/react-codebox";

class App extends Component {
  render() {
    return (
      <div>
        <Codebox
          type="text"
          length={4}
          validator={(input, index) => {
            return /\d/.test(input);
          }}
          onChange={codeArray => {
            console.log(codeArray);
          }}
        />
      </div>
    );
  }
}

License

The MIT License