tfa-input
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

NPM build status npm size npm downloads NPM

tfa-input

Tfa-input is a cool and customizable component built with TypeScript ready to drop in your projects.

Table of content

Built with

Installation

You can use npm

npm i tfa-input

or via Yarn

yarn add tfa-input

API

Option Type Required Default Description
value string / number false [] The value of the input passed into the component.
onSubmit function true undefined Function called when the user filled in the code.
autoFocus boolean false false Optional boolean param to control whether the input should be autofocused on mount.
containerStyle string (className) / object (style) false Style applied or class passed to container of cells.
cellNumberStyle string / object false Style applied or class passed to each cell.
inputStyle string / object false Style applied or class passed to input.
focusColor string false #23d9d9 Color of input cell on focus state.

Example of usage

import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { TfaInput } from 'tfa-input';


const App = () => {
  return (
    <div>
      <TfaInput
        value={123456}
        autoFocus
        onSubmit={(code) => console.log(code)}
        containerStyle="container-classname"
        cellNumberStyle={{ fontSize: '26px'}}
      />
    </div>
  );
};

ReactDOM.render(<App />, document.getElementById('root'));

Contributing

GitHub issues GitHub pull requests

Feel free to open issues and pull requests!

License

This project is licensed under the terms of the MIT license.

Package Sidebar

Install

npm i tfa-input

Weekly Downloads

1

Version

1.0.6

License

MIT

Unpacked Size

50.7 kB

Total Files

13

Last publish

Collaborators

  • diananem