1.0.5 • Published 2 years ago

@udooku/react-image-comparison-slider v1.0.5

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

Installation

npm i @udooku/react-image-comparison-slider

or

yarn add @udooku/react-image-comparison-slider

Usage

import ImageSlider from "@udooku/react-image-comparison-slider";

<div style={{ width: 700, height: 450 }}>
    <ImageSlider
        image1=""
        image2=""
        onSlide={() => {
          console.log("sliding");
        }}
    />
</div>

Props

PropsTypeDefaultDescription
image1string-First image's source (URL, base64 string etc.)
image2string-Second image's source (URL, base64 string etc.)
alt1string"alt1"First image's alt text
alt2string"alt2"Second image's alt text
sliderColorstring"red"Slider's color. Should be valid CSS color expression.
sliderWidthnumber3Slider's width in pixel.
showHandlebooleantrueIf false, hides slider handle.
handleBackgroundColorstring"white"Background color of the slider's handle.
handleColorstring"red"Background color of the triangles on the slider's handle.
customHandleDOM ElementnullRenders the passed DOM element as a slider handle.
sliderInitialPositionnumber0.5Slider's initial position between 0 and 1.
leftLabelTextstringnullA label for the first image.
rightLabelTextstringnullA label for the second image.
showPlaceholderbooleantruePlaceholder is shown while waiting for full image to load
customPlaceholderDOM ElementnullPass your custom placeholder component/element.

Callbacks

PropsTypeDefaultDescription
onSlidefunction-A callback function which is invoked on slider's position change.
onSlideEndfunction-A callback function which is invoked on mouseUp at the end of sliding.
onLoadFirstImagefunction-Is invoked when the first image has finished loading.
onLoadSecondImagefunction-Is invoked when the second image has finished loading.
onErrorFirstImagefunction-Is invoked when an error occurs loading the first image.
onErrorSecondImagefunction-Is invoked when an error occurs loading the second image.

Animation

PropsTypeDefaultDescription
animatebooleanfalseAnimates slider.
animationCycleDurationnumber5000Duration of animation in miliseconds.
ababacceptsacornacorn-globalsacorn-jsxacorn-walkajvajv-errorsajv-keywordsansi-colorsansi-escapesansi-htmlansi-regexansi-stylesanymatchaprobaargparsearr-diffarr-flattenarr-unionarray-equalarray-flattenarray-unionarray-uniqarray-uniqueasn1asn1.jsassertassert-plusassign-symbolsast-typesastral-regexasyncasync-eachasync-limiterasynckitatobaws-sign2aws4babel-plugin-dynamic-import-nodebabel-plugin-istanbulbabel-plugin-jest-hoistbabel-preset-jestbalanced-matchbasebase64-jsbatchbcrypt-pbkdfbig.jsbinary-extensionsbindingsbluebirdbn.jsbody-parserbonjourboolbasebrace-expansionbracesbrorandbrowser-process-hrtimebrowser-resolvebrowserify-aesbrowserify-cipherbrowserify-desbrowserify-rsabrowserify-signbrowserify-zlibbrowserslistbs-loggerbserbufferbuffer-frombuffer-indexofbuffer-xorbuiltin-status-codesbytescacachecache-basecallsitescamel-casecamelcasecaniuse-litecapture-exitcaselesschalkchardetchokidarchownrchrome-trace-eventci-infocipher-baseclass-utilsclean-csscli-cursorcli-widthcliuicocode-point-atcollect-v8-coveragecollection-visitcolor-convertcolor-namecombined-streamcommandercommondircompare-versionscomponent-emittercompressiblecompressionconcat-mapconcat-streamconnect-history-api-fallbackconsole-browserifyconstants-browserifycontent-dispositioncontent-typeconvert-source-mapcookiecookie-signaturecopy-concurrentlycopy-descriptorcore-js-compatcore-util-iscosmiconfigcreate-ecdhcreate-hashcreate-hmaccross-spawncrypto-browserifycss-selectcss-whatcssesccssomcssstylecsstypecyclistdashdashdata-urlsdebugdecamelizedecode-uri-componentdeep-equaldeep-isdefault-gatewaydefine-propertiesdefine-propertydeldelayed-streamdepddes.jsdestroydetect-filedetect-newlinedetect-nodediff-sequencesdiffie-hellmandns-equaldns-packetdns-txtdoctrinedom-converterdom-serializerdomain-browserdomelementtypedomexceptiondomhandlerdomutilsduplexifyecc-jsbnee-firstelectron-to-chromiumellipticemoji-regexemojis-listencodeurlend-of-streamenhanced-resolveentitieserrnoerror-exes-abstractes-to-primitivees6-templatesescape-htmlescape-string-regexpescodegeneslinteslint-scopeeslint-utilseslint-visitor-keysespreeesprimaesqueryesrecurseestraverseesutilsetageventemitter3eventseventsourceevp_bytestokeyexec-shexecaexitexpand-bracketsexpand-tildeexpectexpressextendextend-shallowexternal-editorextglobextsprintffast-deep-equalfast-json-stable-stringifyfast-levenshteinfastparsefaye-websocketfb-watchmanfiggy-puddingfiguresfile-entry-cachefile-uri-to-pathfill-rangefinalhandlerfind-cache-dirfind-upfind-versionsfindup-syncflat-cacheflattedflush-write-streamfollow-redirectsfor-inforever-agentform-dataforwardedfragment-cachefreshfrom2fs-write-stream-atomicfs.realpathfunction-bindfunctional-red-black-treegensyncget-caller-fileget-streamget-valuegetpassglobglob-parentglobal-modulesglobal-prefixglobalsglobbygraceful-fsgrowlyhandle-thinghar-schemahar-validatorharmony-reflecthashas-flaghas-symbolshas-valuehas-valueshash-basehash.jshehmac-drbghomedir-polyfillhpack.jshtml-encoding-snifferhtml-entitieshtml-escaperhtml-minifierhtmlparser2http-deceiverhttp-errorshttp-parser-jshttp-proxyhttp-proxy-middlewarehttp-signaturehttps-browserifyhuman-signalsiconv-liteicss-utilsieee754iferrignoreimport-freshimport-localimurmurhashindexes-ofinfer-ownerinflightinheritsiniinquirerinternal-ipinterpretinvariantinvert-kvipip-regexipaddr.jsis-absolute-urlis-accessor-descriptoris-argumentsis-arrayishis-binary-pathis-bufferis-callableis-ciis-data-descriptoris-date-objectis-descriptoris-extendableis-extglobis-fullwidth-code-pointis-generator-fnis-globis-numberis-path-cwdis-path-in-cwdis-path-insideis-plain-objectis-promiseis-regexis-streamis-symbolis-typedarrayis-windowsis-wslisarrayisexeisobjectisstreamistanbul-lib-coverageistanbul-lib-instrumentistanbul-lib-reportistanbul-lib-source-mapsistanbul-reportsjest-changed-filesjest-clijest-configjest-diffjest-docblockjest-eachjest-environment-jsdomjest-environment-nodejest-get-typejest-haste-mapjest-jasmine2jest-leak-detectorjest-matcher-utilsjest-message-utiljest-mockjest-pnp-resolverjest-regex-utiljest-resolvejest-resolve-dependenciesjest-runnerjest-runtimejest-serializerjest-snapshotjest-utiljest-validatejest-watcherjest-workerjs-tokensjs-yamljsbnjsdomjsescjson-parse-better-errorsjson-schemajson-schema-traversejson-stable-stringify-without-jsonifyjson-stringify-safejson3json5jsprimkillablekind-ofkleurlcidlevenlevenarylevnlines-and-columnsloader-runnerloader-utilslocate-pathlodashlodash.memoizelodash.sortbyloglevellolexloose-envifylower-caselru-cachemake-dirmake-errormakeerrormamacromap-age-cleanermap-cachemap-visitmd5.jsmedia-typermemmemory-fsmerge-descriptorsmerge-streammethodsmicromatchmiller-rabinmimemime-dbmime-typesmimic-fnminimalistic-assertminimalistic-crypto-utilsminimatchminimistmississippimixin-deepmkdirpmove-concurrentlymsmulticast-dnsmulticast-dns-service-typesmute-streamnannanomatchnatural-comparenegotiatorneo-asyncnice-tryno-casenode-forgenode-int64node-libs-browsernode-modules-regexpnode-notifiernode-releasesnormalize-pathnpm-run-pathnth-checknumber-is-nannwsapioauth-signobject-assignobject-copyobject-inspectobject-isobject-keysobject-visitobject.assignobject.getownpropertydescriptorsobject.pickobufon-finishedon-headersonceonetimeopencollective-postinstallopnoptionatororiginalos-browserifyos-localeos-tmpdirp-deferp-each-seriesp-finallyp-is-promisep-limitp-locatep-mapp-retryp-trypakoparallel-transformparam-caseparent-moduleparse-asn1parse-jsonparse-passwdparse5parseurlpascalcasepath-browserifypath-dirnamepath-existspath-is-absolutepath-is-insidepath-keypath-parsepath-to-regexppath-typepbkdf2performance-nowpicomatchpifypinkiepinkie-promisepiratespkg-dirplease-upgrade-nodepnportfinderposix-character-classespostcsspostcss-modules-extract-importspostcss-modules-local-by-defaultpostcss-modules-scopepostcss-modules-valuespostcss-selector-parserpostcss-value-parserprelude-lspretty-errorpretty-formatprivateprocessprocess-nextick-argsprogresspromise-inflightpromptsproxy-addrprrpslpublic-encryptpumppumpifypunycodeqsquerystringquerystring-es3querystringifyrandombytesrandomfillrange-parserraw-bodyreact-isreadable-streamreaddirprealpath-nativerecastregenerateregenerate-unicode-propertiesregenerator-runtimeregenerator-transformregex-notregexp.prototype.flagsregexppregexpu-coreregjsgenregjsparserrelateurlremove-trailing-separatorrenderkidrepeat-elementrepeat-stringrequestrequest-promise-corerequest-promise-nativerequire-directoryrequire-main-filenamerequires-portresolveresolve-cwdresolve-dirresolve-fromresolve-urlrestore-cursorretretryrimrafripemd160rsvprun-asyncrun-queuerxjssafe-buffersafe-regexsafer-buffersanesaxesschedulerschema-utilsselect-hoseselfsignedsemversemver-comparesemver-regexsendserialize-javascriptserve-indexserve-staticset-blockingset-valuesetimmediatesetprototypeofsha.jsshebang-commandshebang-regexshellwordssignal-exitsisteransislashslice-ansisnapdragonsnapdragon-nodesnapdragon-utilsockjssockjs-clientsource-list-mapsource-mapsource-map-resolvesource-map-supportsource-map-urlspdyspdy-transportsplit-stringsprintf-jssshpkssristack-utilsstatic-extendstatusesstealthy-requirestream-browserifystream-eachstream-httpstream-shiftstring_decoderstring-lengthstring-widthstring.prototype.trimleftstring.prototype.trimrightstrip-ansistrip-bomstrip-eofstrip-final-newlinestrip-json-commentssupports-colorsupports-hyperlinkssymbol-treetabletapableterminal-linkterserterser-webpack-plugintest-excludetext-tablethroatthroughthrough2thunkytimers-browserifytmptmplto-arraybufferto-fast-propertiesto-object-pathto-regexto-regex-rangetoidentifiertoposorttough-cookietr46tslibtsutilstty-browserifytunnel-agenttweetnacltype-checktype-detecttype-festtype-istypedarraytypedarray-to-bufferuglify-jsunicode-canonical-property-names-ecmascriptunicode-match-property-ecmascriptunicode-match-property-value-ecmascriptunicode-property-aliases-ecmascriptunion-valueuniqunique-filenameunique-slugunpipeunset-valueupathupper-caseuri-jsurixurlurl-parseuseutilutil-deprecateutil.promisifyutilautils-mergeuuidv8-compile-cachev8-to-istanbulvaryverrorvm-browserifyw3c-hr-timew3c-xmlserializerwalkerwatchpackwbufwebidl-conversionswebpack-dev-middlewarewebpack-logwebpack-sourceswebsocket-driverwebsocket-extensionswhatwg-encodingwhatwg-mimetypewhatwg-urlwhichwhich-modulewhich-pm-runsword-wrapworker-farmwrap-ansiwrappywritewrite-file-atomicwsxml-name-validatorxmlcharsxtendy18nyallistyamlyargsyargs-parser
1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago