2.4.2 • Published 2 years ago

react-otp-input-uptd v2.4.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-otp-input

npm version npm npm All Contributors

A fully customizable, one-time password input component for the web built with React.

see here

Live Demo

CodeSandbox

Installation

NPM

To install the latest stable version:

npm install --save react-otp-input

Basic usage:

import React, { Component } from 'react';
import OtpInput from 'react-otp-input';

export default class App extends Component {
  state = { otp: '' };

  handleChange = (otp) => this.setState({ otp });

  render() {
    return (
      <OtpInput
        value={this.state.otp}
        onChange={this.handleChange}
        numInputs={6}
        separator={<span>-</span>}
      />
    );
  }
}

API

Breaking changes when porting to v1.0.0

react-otp-input is now a controlled component to facilitate functionalities that weren't possible before from the application using it, such as clearing or pre-assigning values. For v1.0.0 and above, a value prop needs to be passed in the component for it to function as expected.

Development

To run the development server:

npm run dev

Checklist

PRs Welcome Open Source Love

  • Add flowtypes
  • Add ESLint, Prettier for code quality
  • Add styling support for states including focus/disabled
  • Write tests

Contributing

GitHub issues GitHub pull requests

Feel free to open issues and pull requests!

License

NPM

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

acceptsacornacorn-jsxajvansi-colorsajv-keywordsansi-htmlajv-errorsansi-stylesansi-regexanymatchaprobaargparsearr-flattenarr-diffarr-unionaria-queryarray-includesarray-flattenarray-uniqarray-unionarray.prototype.flatarray-uniquearray.prototype.flatmaparray.prototype.reduceasn1.jsassertastral-regexast-types-flowasync-eachassign-symbolsasyncatobbabel-plugin-dynamic-import-nodeaxe-corebabel-plugin-polyfill-corejs2axobject-querybalanced-matchasync-limiterbabel-plugin-polyfill-regeneratorbase64-jsbasebabel-plugin-polyfill-corejs3big.jsbindingsbinary-extensionsbluebirdbatchbonjourbody-parserbn.jsboolbasebrace-expansionbrorandbracesbrowserify-aesbrowserify-cipherbrowserify-desbrowserify-signbrowserify-rsabrowserify-zlibbufferbrowserslistbuffer-frombuffer-indexofbuiltin-status-codesbuffer-xorbytescacachecall-bindcallsitescache-basecamel-casecaniuse-litecamelcasechalkchownrcipher-baseclean-csschrome-trace-eventclass-utilschokidarcolor-convertcollection-visitcolor-namecliuicommondircomponent-emittercompressiblecommandercompressionconcat-mapconcat-streamconnect-history-api-fallbackconstants-browserifycontent-dispositionconsole-browserifycookie-signaturecontent-typeconvert-source-mapcookiecopy-concurrentlycopy-descriptorcore-js-compatcreate-hashcore-js-purecore-util-iscreate-ecdhcreate-hmaccross-spawncss-selectcrypto-browserifycss-whatcssescdate-fnscyclistdamerau-levenshteindebugdeep-isdecode-uri-componentdecamelizedeep-equaldefault-gatewaydefine-propertiesdefine-propertydeldepddestroydetect-filedes.jsdns-txtdetect-nodedns-equaldns-packetdiffie-hellmandom-serializerdom-converterdomelementtypedomain-browserdoctrinedomutilsee-firstelectron-to-chromiumduplexifyellipticemail-addressesdot-casedomhandleremoji-regexemojis-listenquirerend-of-streamencodeurlenhanced-resolvees-abstracterrnoentitieses-to-primitivees-array-method-boxes-properlyerror-exes-shim-unscopablesescaladeescape-string-regexpescape-htmleslint-import-resolver-nodeeslint-scopeeslint-utilsespreeeslint-visitor-keysesprimaesqueryestraverseesrecurseeslint-module-utilsesutilsetageventemitter3eventsourceeventsexecaevp_bytestokeyexpand-tildeexpand-bracketsexpressextend-shallowfast-deep-equalextglobfast-levenshteinfast-json-stable-stringifyfast-difffiggy-puddingfile-entry-cachefaye-websocketfilename-reserved-regexfilenamifyfill-rangefinalhandlerfile-uri-to-pathfind-cache-dirfind-upfindup-syncflattedflush-write-streamfollow-redirectsforwardedfor-infreshfragment-cachefrom2fs-extrafseventsfs-readdir-recursivefs.realpathgensyncflat-cachefunction-bindget-caller-filefunction.prototype.namefunctional-red-black-treefunctions-have-namesget-intrinsicget-streamget-valueget-symbol-descriptionglobal-prefixglobbyglobglobal-modulesglobalsglob-parenthandle-thinghas-flaggraceful-fshashas-bigintshas-tostringtaghas-valuehas-symbolshas-property-descriptorshash-basehas-valueshmac-drbghash.jshehosted-git-infohtml-entitieshtml-minifier-terserhomedir-polyfillhpack.jshtmlparser2http-deceiverhttp-errorshttp-proxy-middlewarehttp-parser-jshttp-proxyiconv-liteicss-utilshttps-browserifyieee754fs-write-stream-atomicignoreimport-freshimurmurhashinflightinheritsiniinternal-slotipinfer-ownerinternal-ipimport-localinterpretip-regexipaddr.jsis-accessor-descriptoris-argumentsis-absolute-urlis-arrayishis-bigintis-boolean-objectis-binary-pathis-core-moduleis-bufferis-date-objectis-data-descriptoris-callableis-extendableis-globis-descriptoris-fullwidth-code-pointis-numberis-extglobis-path-cwdis-path-in-cwdis-number-objectis-negative-zerois-path-insideis-plain-objectis-regexis-shared-array-bufferis-streamis-symbolis-weakrefis-stringis-windowsisarrayis-wslisobjectisexejs-tokensjs-yamljson-parse-better-errorsjson-parse-even-better-errorsjson-schema-traversejson-stable-stringify-without-jsonifyjsescjson5jsonfilejsx-ast-utilskillablelanguage-subtag-registrykind-oflanguage-tagslevnload-json-filelines-and-columnsiferrloader-runnerlodash.mergelodash.truncatelodash.debounceloader-utilsloose-envifylodashlower-caseloglevellru-cachemap-cachemd5.jsmake-dirmap-visitmedia-typermerge-descriptorsmemory-fsmicromatchmethodsmiller-rabinmimemime-typesmime-dbminimalistic-assertminimatchminimalistic-crypto-utilsminimistmove-concurrentlymixin-deepmkdirpmulticast-dnsmississippinannanomatchmulticast-dns-service-typesnatural-comparemsno-casenice-trynegotiatornode-forgenode-libs-browsernode-releasesnormalize-package-datanpm-run-pathneo-asyncobject-assignobject-copynth-checknormalize-pathobject-inspectobject-keysobject-visitobject.entriesobject.assignobject-isobufobject.getownpropertydescriptorsobject.fromentrieson-headersobject.pickobject.valuesopnon-finishedonceoptionatoros-browserifyp-finallyp-limitp-locatep-mapp-retryp-tryparam-casepakoparallel-transformparent-moduleparse-passwdparse-asn1parse-jsonpath-browserifypascal-caseparseurlpascalcasepath-dirnamepath-existspath-keypath-is-insidepath-is-absolutepath-typepath-parsepath-to-regexppbkdf2picocolorspicomatchpifypinkiepinkie-promisepkg-dirpkg-upportfinderposix-character-classespostcsspostcss-modules-extract-importspostcss-modules-scopepostcss-modules-valuespostcss-value-parserpostcss-modules-local-by-defaultpostcss-selector-parserprettier-linter-helperspretty-errorprelude-lsprocess-nextick-argsprocessprogressproxy-addrpromise-inflightprrpunycodepumppublic-encryptprop-typespumpifyqsquerystringquerystringifyquerystring-es3read-pkgrandomfillrange-parserrandombytesraw-bodyreact-isread-pkg-upreadable-streamreaddirpregenerateregenerate-unicode-propertiesregenerator-runtimeregenerator-transformregexp.prototype.flagsregex-notregexpu-coreregexppregjsgenregjsparserremove-trailing-separatorrenderkidrepeat-elementrepeat-stringrelateurlrequire-directoryrequire-from-stringrequires-portrequire-main-filenameresolve-cwdresolve-dirresolve-urlresolveresolve-fromretretryrimrafripemd160run-queuerxjssafe-bufferlocate-pathschedulersafe-regex-testsafer-bufferschema-utilsselfsignedselect-hosesendsemverserve-indexset-valueserve-staticset-blockingsafe-regexsetimmediatesetprototypeofserialize-javascriptshebang-commandsha.jsshebang-regexsignal-exitslice-ansiside-channelsnapdragon-nodeslashsockjs-clientsnapdragon-utilsource-list-mapsnapdragonsockjssource-map-supportsource-map-urlsource-mapsource-map-resolvespawn-commandspdx-correctspdx-license-idsspdy-transportspdx-expression-parsespdysplit-stringsprintf-jsssristatic-extendstatusesstream-browserifystream-eachstream-httpstream-shiftstring-widthstring_decoderstring.prototype.matchallstring.prototype.trimstartstring.prototype.trimendstrip-ansistrip-bomstrip-outerstrip-eofstrip-json-commentssupports-colortapablesupports-preserve-symlinks-flagtableterserterser-webpack-plugintext-tablethunkythrough2timers-browserifyto-regex-rangeto-fast-propertiesto-arraybufferto-object-pathspdx-exceptionstree-killtoidentifierto-regextslibtty-browserifytype-checktsconfig-pathstypedarraytype-istype-festunicode-canonical-property-names-ecmascriptunbox-primitiveunicode-property-aliases-ecmascriptunicode-match-property-ecmascriptunique-filenametrim-repeatedunicode-match-property-value-ecmascriptunique-slugunpipeuniversalifyunion-valueunset-valueupathupdate-browserslist-dburluri-jsuseurixutilutil-deprecateutil.promisifyutilautils-mergev8-compile-cacheuuidvm-browserifyvaryvalidate-npm-package-licensewatchpackwatchpack-chokidar2webpack-dev-middlewarewebpack-sourceswebpack-logwbufwebsocket-driverwebsocket-extensionswhich-boxed-primitiveurl-parsewhich-modulewhichword-wrapwrappywsworker-farmy18nyallistxtendwrap-ansiyargs-parseryargs
2.4.2

2 years ago

2.4.1

2 years ago