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

@fabianb/react-styled-slides

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

@fabianb/react-styled-slides

A styled-component slider for React.

  • 0.1.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

react-styled-slides

A styled-component slider for React.

1. Import & state

import Slider from "./Slider";

state = {
  slideIndex: 0,
}

2. Set up

<Slider
  slideIndex={0}
  slidesInView={1}
  gutterWidth={20}
>
  <div>Slide1</div>
  <div>Slide2</div>
  <div>Slide3</div>
</Slider>

3. Add logics

goToSlide = (increment) => {
  const { slideIndex } = this.state
  this.setState({
    slideIndex: slideIndex + increment
  })
};
  
<Slider
...
  prevSlide={() => this.goToSlide(-1)} // When you swipe or drag right
  nextSlide={() => this.goToSlide(1)} // When you swipe or drag left
>
...


Check out this demo.

Alt text

Keywords

FAQs

Package last updated on 17 Apr 2019

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