New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

react-input-code

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-input-code

React component to insert a code in a series of single char input elements

latest
Source
npmnpm
Version
1.0.10
Version published
Weekly downloads
4
-76.47%
Maintainers
1
Weekly downloads
 
Created
Source

react-input-code

React component to insert a code in a series of single char input elements

demo_image

NPM JavaScript Style Guide

Install

npm install --save react-input-code

Usage

1 . Require react-input-code after installation

import ReactInputCode from 'react-input-code';

2 . Add style css from module

import 'react-input-code/dist/index.css'

3 . Include react-input-code as in the following example

import React, { useState } from 'react'
import ReactInputCode from 'react-input-code'
import 'react-input-code/dist/index.css'

const App = () => {
  const [value, setValue] = useState('')

  return <>
    <ReactInputCode
      value={value}
      onChange={setValue}
      type="text"
      className="my-input-code"
      itemClassName="my-code-item"
      nItems={6}
      autoFocus={true} 
      placeholder={'-'}
      disabled={true}/>
}

Props

  • nItems - number of items composing che html input code component
  • value - control the current value
  • onChange - subscribe to change events
  • type - (optional) type attribute of each html input element ('text', 'number', 'password', etc...). Default value is 'text'
  • className - (optional) additional class applied to the component container
  • itemClassName - (optional) additional class applied to each element
  • autoFocus - (optional) if set to true the first elemnt will be focused on component load
  • placeholder - (optional) placeholder, the same char introduced in each element. If more than one char is present, only the first char will be considered
  • disabled - (optional) controls field disabled prop

Controlled Props

You can control the value / onChange props (specify the current value of the control) by providing values for them.

License

MIT © [Mario Fornaroli](https://github.com/Mario Fornaroli)

Keywords

react

FAQs

Package last updated on 04 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts