npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@avant-arte/react-code-input

v3.10.1

Published

React component for entering and validating numbers, text or password.

Downloads

11

Readme

react-code-input

React component for entering and validating PIN code.

CircleCI npm version codecov

Live example here

Installation

npm i --save react-code-input

Usage

Numeric input:

Numeric input

...
<ReactCodeInput type='number' fields={6} />
...

Text input:

Text input

...
<ReactCodeInput type='text' fields={6} />
...

Password input:

Password input

...
<ReactCodeInput type='password' fields={6} />
...

Numeric input with options:

Numeric input with options

import { reactCodeInput } from 'CodeInputField.scss'
...
const props = {
  className: reactCodeInput,
  inputStyle: {
    fontFamily: 'monospace',
    margin:  '4px',
    MozAppearance: 'textfield',
    width: '15px',
    borderRadius: '3px',
    fontSize: '14px',
    height: '26px',
    paddingLeft: '7px',
    backgroundColor: 'black',
    color: 'lightskyblue',
    border: '1px solid lightskyblue'
  },
  inputStyleInvalid: {
    fontFamily: 'monospace',
    margin:  '4px',
    MozAppearance: 'textfield',
    width: '15px',
    borderRadius: '3px',
    fontSize: '14px',
    height: '26px',
    paddingLeft: '7px',
    backgroundColor: 'black',
    color: 'red',
    border: '1px solid red'
  }
}
...
<ReactCodeInput type='number' fields={6} {...props}/>
...

Usage with next.js

import dynamic from 'next/dynamic';

const ReactCodeInput = dynamic(import('react-code-input'));
...
<ReactCodeInput type='number' fields={6} {...props}/>
...

Props:

| Property | Type | Description | | :--------------------- | :----- | :--------------------------------------------------------------------------------------------------- | | type | string | Only types like: text, number, password and tel are accepted. | | fields | number | Allowed amount of characters to enter. | | value | string | Setting the value of code input field. | | placeholder | string | Setting the placeholder of code input field. | | name | string | Setting the name of component. | | onChange | func | Function, which is called whenever there is a change of value in the input box. | | touch | func | Marks the given fields as "touched" to show errors. | | untouch | func | Clears the "touched" flag for the given fields. | | className | string | Add classname to the root element. | | style | object | Setting the styles of container element. | | inputStyle | object | Setting the styles of each input field. | | inputStyleInvalid | object | Setting the styles of each input field if isValid prop is false. | | isValid | bool | Returns true if an input element contains valid data. | | disabled | bool | When present, it specifies that the element should be disabled. | | autoFocus | bool | Setup autofocus on the first input, true by default. | | filterKeyCodes | array | Filter characters on key down. | | filterChars | array | Filter characters; default is ['-', '.'] | | filterCharsIsWhitelist | bool | filterChars acts as blacklist if false, whitelist if true; false by default. | | pattern | string | The pattern prop specifies a regular expression that the element's value is checked against. | | inputMode | string | The inputMode prop tells the browser on devices with dynamic keyboards which keyboard to display. | | autoComplete | string | The autoComplete prop specifies whether or not an input field should have autocomplete enabled. |

Compatible with

redux-form from erikras

next.js from zeit

License

MIT