2.4.1 • Published 2 years ago

@beldore/react-otp-input v2.4.1

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!

ajv-errorsacceptsacornacorn-jsxanymatchansi-colorsajvansi-stylesajv-keywordsaprobaarr-unionansi-regexarr-diffargparseansi-htmlarray-flattenarray-unionarray-uniqarr-flattenarray-includesassign-symbolsarray-uniqueast-types-flowastral-regexassertarray.prototype.flatmaparray.prototype.flatasyncasn1.jsasync-eachbabel-plugin-polyfill-corejs2axobject-queryatobasync-limiterbabel-plugin-dynamic-import-nodebabel-plugin-polyfill-regeneratorbatchbasebig.jsaxe-corebluebirdbonjourbody-parserbabel-plugin-polyfill-corejs3base64-jsbracesbinary-extensionsbn.jsbrorandbrowserify-desbrace-expansionbrowserify-zlibbrowserify-aesboolbasebrowserify-cipherbindingsbrowserify-rsabuffer-indexofbrowserify-signbufferbuffer-xorbytesbuiltin-status-codescallsitesbrowserslistcall-bindcache-basecamelcasecacachecamel-casechrome-trace-eventbuffer-fromcipher-basechownrclass-utilschokidarcliuicolor-namecollection-visitchalkcolor-convertcommondirclean-cssconcat-mapcolorettecompressiblecompressionconcat-streamcommanderconstants-browserifyconvert-source-mapconnect-history-api-fallbackcontent-dispositioncontent-typecookiecopy-descriptorcopy-concurrentlyconsole-browserifycore-util-iscomponent-emittercross-spawncore-js-compatcore-js-purecreate-hmaccrypto-browserifydebugcreate-ecdhcyclistcreate-hashdeep-iscssescdamerau-levenshteindecamelizedeep-equaldefault-gatewaydepddefine-propertydetect-filedestroydetect-nodedns-equaldiffie-hellmandns-txtdoctrinedefine-propertiesdate-fnsdom-converterdomain-browseree-firstdes.jsemoji-regexcaniuse-liteduplexifyemojis-listcookie-signaturedns-packetencodeurldot-caseemail-addressesellipticenhanced-resolveerror-exend-of-streames-abstractescape-htmlerrnoescape-string-regexpenquirerentitieses-to-primitivedecode-uri-componenteslint-scopeeslint-module-utilseslint-visitor-keysesqueryescaladeeslint-utilsespreeeslint-import-resolver-nodeesprimaesutilsevp_bytestokeyetagesrecurseeventsexpressexpand-tildeestraverseextend-shallowfast-json-stable-stringifyfaye-websocketfast-levenshteinextglobfast-deep-equalfile-uri-to-pathfast-difffiggy-puddingfinalhandlerfill-rangefind-upfilename-reserved-regexfile-entry-cachefilenamifyfindup-syncflush-write-streamfollow-redirectsfor-infragment-cachefind-cache-dirfreshflat-cacheforwardedfrom2fs-extraflattedfs-write-stream-atomicfs.realpathfunctional-red-black-treefunction-bindfs-readdir-recursiveget-streamforeachget-caller-filegensyncglob-parentget-intrinsicget-valuefseventsglobal-modulesglobalsglobal-prefixhasglobbyhandle-thinghas-flaghas-valuesglobhas-valuegraceful-fshash.jshmac-drbghas-bigintshash-basehehomedir-polyfillhpack.jshas-symbolshtml-entitieshosted-git-infohttp-deceiverhttp-proxyhttp-errorshttps-browserifyicss-utilsiferrhttp-proxy-middlewareignoreimport-localimurmurhashinflighthtml-minifier-terserhttp-parser-jsimport-freshinfer-ownerinheritsieee754ipinternal-ipip-regexis-accessor-descriptorinternal-slotipaddr.jsis-arrayishis-argumentsiniis-binary-pathinterpretis-bufferis-data-descriptoris-absolute-urlis-boolean-objectis-extglobis-callableis-core-moduleis-extendableis-fullwidth-code-pointis-date-objectis-numberis-globis-descriptoris-negative-zerois-bigintis-path-in-cwdis-path-cwdis-path-insideis-oddis-number-objectis-streamis-windowsis-plain-objectis-wslis-symbolisobjectis-stringisarrayis-regexisexejson-parse-better-errorsjsescjs-tokensjson-stable-stringify-without-jsonifyjson5json-schema-traversejson-parse-even-better-errorsjs-yamlkillablekind-ofjsonfilejsx-ast-utilsjson3language-subtag-registrylevnlines-and-columnslanguage-tagslocate-pathloader-runnerload-json-filelodash.mergelodash.clonedeeplodash.debouncelodash.truncateloader-utilslodashlower-casemap-cacheloglevelloose-envifymap-visitmedia-typermd5.jsmicromatchmiller-rabinmerge-descriptorsmethodsmake-dirmemory-fsminimalistic-assertlru-cachemime-typesminimalistic-crypto-utilsminimatchmississippimixin-deepmsmove-concurrentlymimemime-dbminimistmulticast-dns-service-typesmulticast-dnsmkdirpnatural-comparenice-trynannegotiatornanomatchneo-asyncnormalize-pathnode-libs-browserno-casenormalize-package-dataobject-copynode-forgeobject-assignnode-releasesnpm-run-pathobject-isobject-inspectobject.assignobject.entriesobject-visitobufobject.fromentriesobject-keysobject.valuesobject.pickon-headerson-finishedonceoriginalos-browserifyp-finallyp-locatep-tryoptionatorp-limitobject.getownpropertydescriptorsparse-jsonparent-moduleparallel-transformparam-caseparse-passwdparseurlpath-dirnamepath-browserifyparse-asn1path-existspascal-casepakopath-is-absolutepath-is-insidepath-to-regexppascalcasepath-typepicomatchpath-keypifypinkiepinkie-promisepath-parsepkg-uppostcss-modules-extract-importspostcsspkg-dirpbkdf2posix-character-classesportfinderpostcss-modules-valuespostcss-modules-local-by-defaultprettier-linter-helpersprelude-lspostcss-selector-parserprogresspostcss-value-parserpromise-inflightprocesspostcss-modules-scopeprocess-nextick-argsprop-typesprrpretty-errorproxy-addrpumppublic-encryptpumpifyquerystringpunycodequerystringifyquerystring-es3randombytesreact-isrange-parserraw-bodyrandomfillaria-queryreaddirpread-pkg-upreadable-streamregex-notregenerateregenerator-runtimeregenerator-transformregexppregenerate-unicode-propertiesrelateurlremove-trailing-separatorrenderkidregexpu-coreregexp.prototype.flagsrequire-from-stringrequire-main-filenamerepeat-elementrequires-portrequire-directoryresolve-dirrepeat-stringresolve-fromresolve-urlretretryripemd160run-queueread-pkgsafe-regexsafer-buffersafe-bufferselect-hoseresolvesendschema-utilsrimrafserve-indexrxjsserve-staticselfsignedsemverserialize-javascriptsetimmediatesha.jsschedulershebang-regexset-valueset-blockingslashshebang-commandsetprototypeofsnapdragon-utilsignal-exitsnapdragon-nodesource-list-mapsource-mapsnapdragonslice-ansisource-map-urlside-channelsockjsspdx-correctspawn-commandspdx-expression-parsesplit-stringspdx-exceptionsspdy-transportsprintf-jssource-map-resolvestatic-extendstatusesstream-browserifystream-httpspdx-license-idsstream-eachspdyssristream-shiftstrip-bomstrip-eofstring.prototype.matchallstring.prototype.trimendstring.prototype.trimstartstring-widthstrip-ansitapablestrip-json-commentstablestrip-outerstring_decodertext-tablesupports-colorto-fast-propertiesto-arraybufferthunkyto-object-paththrough2terser-webpack-pluginterserto-regextoidentifiertsconfig-pathsto-regex-rangetslibtimers-browserifytype-checktty-browserifytype-istrim-repeatedunicode-match-property-ecmascriptunbox-primitiveunicode-property-aliases-ecmascripttree-killtype-festtypedarrayunicode-canonical-property-names-ecmascriptunion-valueunique-slugunique-filenameuniversalifyunpipeuri-jsurixurlunicode-match-property-value-ecmascriptunset-valueutilutilaurl-parseupathuseutil.promisifyvalidate-npm-package-licenseuuidvaryutils-mergep-retryutil-deprecatewbufv8-compile-cachewatchpackwebpack-sourcesvm-browserifywatchpack-chokidar2which-boxed-primitivewebpack-logwebsocket-driverwebpack-dev-middlewarewhichwhich-moduleword-wrapxtendwrap-ansiworker-farmwebsocket-extensionswrappywsy18nyallistyargs
2.4.1

2 years ago

2.4.0

2 years ago