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

w-react-pin-input

v1.0.4

Published

React component for PIN like input

Downloads

11

Readme

react-pin-input

There is another package for managing PIN input. Check and see which suits you better.

Build Status

React-PIN-Input is a React component o capture PIN/MPIN like input

alt tag

Demo

https://codesandbox.io/s/8jnlxw359

Installation

npm install w-react-pin-input --save

Usage

The component takes in the length of the PIN and two callback to notifiy change and completion. The index is the input which is currently in focus.

import PinInput from 'react-pin-input';

<PinInput 
  length={4} 
  initialValue=""
  secret 
  onChange={(value, index) => {}} 
  type="numeric" 
  inputMode="number"
  style={{padding: '10px'}}  
  inputStyle={{borderColor: 'red'}}
  inputFocusStyle={{borderColor: 'blue'}}
  onComplete={(value, index) => {}}
  autoSelect={true}
  regexCriteria={/^[ A-Za-z0-9_@./#&+-]*$/}
/>

|Attribute|Type|Description| |:--|:--|:--| |length|number|Number of inputs| |initialValue|number|string|Initial value of inputs| |type|string|Type of input allowed ||| if numeric, the input will take only numbers| ||| if custom, the input will take other than numbers| |secret|boolean|If you set the secret attibute, the input will be hidden as shown below. |disabled|boolean|If you set the disable attibute, the input will be disabled. |focus|boolean| Setting the focus attibute will set the default focus on the first input element. |onChange|function|Callback function invoked on input change. The first parameter is the value and the second is the index of the input that is currently in focus| |onComplete|function|Callback function invoked when all inputs have valid values. The first parameter is the value and the second is the index of the input that is currently in focus| |style|object|Style for the container div |inputStyle|object|Style for the input element |inputFocusStyle|object|Style for the input element when on focus |autoSelect|boolean|Setting autoSelect to false will stop automatically highlighting input values on focus. This eliminates popup focus flashing on iOS.| |regexCriteria|any|Add validation for alphanumeric type. NOTE: default value is /^[ A-Za-z0-9_@./#&+-]*$/

Display when secret is set alt tag

Additional APIs

<PinInput length={4} ref={(n) => ele=n} />
  • ele.focus() to set focus on the first input element.
  • ele.clear to clear the values

Custom Style

You can update the style via following props

  • style
  • inputStyle
  • inputFocusStyle

Or another option is to override the default style(shown below is scss. For css refer ).

.pincode-input-container
{
  .pincode-input-text
  {
    padding:0 !important;
    margin:0 2px;
    text-align:center;
    border: 1px solid;
    background: transparent;
    width: 50px;
    height: 50px;
  }
  .pincode-input-text:focus
  {
    outline:none;
    box-shadow:none;
  }
}

For developers

New build

npm run build

Run dev server

npm run dev

Run test

npm run test