Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react420-slider

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react420-slider

[![ReactJs][react-image]][react-url] [![Download Count][download-image]][download-url] [![GitHub license][license-image]][license-url]

  • 1.0.0
  • unpublished
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

react-simple-image-slider

ReactJs Download Count GitHub license

Simple ImageSlider Component for ReactJS v17

  • Just Two Elements will be used. (for display images)
  • Support GPU Render, by default.
  • Support Image Preload.
  • Support SSR. ( server-side-rendering )
  • Selectable Navigation Styles.

Live demo

Install

// npm
npm install react-simple-image-slider --save

// yarn
yarn add react-simple-image-slider

Usage

import SimpleImageSlider from "react-simple-image-slider";

const images = [
  { url: "images/1.jpg" },
  { url: "images/2.jpg" },
  { url: "images/3.jpg" },
  { url: "images/4.jpg" },
  { url: "images/5.jpg" },
  { url: "images/6.jpg" },
  { url: "images/7.jpg" },
];

const App = () => {
  return (
    <div>
      <SimpleImageSlider
        width={896}
        height={504}
        images={images}
        showBullets={true}
        showNavs={true}
      />
    </div>
  );
}

If You want to see more detail source,

Props

NameTypeRequiredDescriptionDefault
widthNumberRequiredImage Slider Width
heightNumberRequiredImage Slider Height
imagesArrayRequiredImages,
Array Elements should be like this structure,
{ url: "" }
styleStringOptionalcss object
slideDurationNumberOptionalcss transition-duration property0.5
navStyleNumberOptionalArrow Navgation Style,
1 or 2
1
navSizeNumberOptionalArrow Size50
navMarginNumberOptionalArrow Margin30
showNavsBooleanRequiredToggle Arrow
startIndexNumberOptionalstart Index of Slide0
showBulletsBooleanRequiredToggle Bulletstrue
loopBooleanOptionallooping slidertrue
autoPlayBooleanOptionalauto playfalse
autoPlayDelayBooleanOptionalauto play delay2.0
useGPURenderBooleanOptionalToggle GPU Rendertrue
bgColorStringOptionalslider container's css background-color property#000000
onClickFunctionOptionalImage Click Callback function,
onClick = (idx, event) => { }
idx : number : clicked bullet index (begin from 0)
onClickNavFunctionOptionalArrow Navigation Callback function,
onClickNav = (toRight) => { }
toRight : Boolean : slide direction
onClickBulletsFunctionOptionalBullets Callback function,
onClickBullets = (idx) => { }
idx : Number : clicked bullet index (begin from 0)
onStartSlideFunctionOptionalSlide Transition Start function,
onStartSlide = (idx, length) => { }
idx : Number : start index (begin from 1)
length : Number : image length
onCompleteSlideFunctionOptionalSlide TransitionEnd Callback function,
onCompleteSlide = (idx, length) => { }
idx : Number : start index (begin from 1)
length : Number : image length

If You want to see more detail,

Style customize

  • can customize by className with !important;
.your-app {
  .rsis-container {
    // do something
  }
}

.your-app {
  .rsis-image {
    background-size: contain !important;
  }
}

Development

directory & source

  • ./example/ : demo site souce for testing component
  • ./src/ : image slider component source
  • ./dist/ : image slider component distribution
  • ./babelrc : babel configure. (version 7.x)
  • ./webpack.config.js : webpack configure. (version 4.x)
  • ./rollup.config.js : rollup configure.

scripts

// npm
npm run example         // run a test app(demo) by webpack dev server
npm run build           // build the image slider component by rollup
npm run build:watch     // build watch mode

// yarn
yarn example
yarn build
yarn build:watch

If you want to run a test app, should build before do that.

After run example by webpack dev server,
open http://localhost:8080/ in a browser

License

MIT

Keywords

FAQs

Package last updated on 01 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc