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

react-swipeable-views

Package Overview
Dependencies
Maintainers
3
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-swipeable-views

A React component for swipeable views

  • 0.14.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
203K
increased by5.48%
Maintainers
3
Weekly downloads
 
Created

What is react-swipeable-views?

The react-swipeable-views package allows you to create swipeable views in your React applications. It is particularly useful for implementing carousels, image galleries, and other swipeable interfaces.

What are react-swipeable-views's main functionalities?

Basic Swipeable View

This code demonstrates a basic swipeable view with three slides. Users can swipe left or right to navigate between the slides.

import React from 'react';
import SwipeableViews from 'react-swipeable-views';

const BasicSwipeableView = () => (
  <SwipeableViews>
    <div>Slide 1</div>
    <div>Slide 2</div>
    <div>Slide 3</div>
  </SwipeableViews>
);

export default BasicSwipeableView;

Auto Play Swipeable View

This code demonstrates an auto-playing swipeable view. The slides will automatically transition after a set interval.

import React from 'react';
import SwipeableViews from 'react-swipeable-views';
import { autoPlay } from 'react-swipeable-views-utils';

const AutoPlaySwipeableViews = autoPlay(SwipeableViews);

const AutoPlayView = () => (
  <AutoPlaySwipeableViews>
    <div>Slide 1</div>
    <div>Slide 2</div>
    <div>Slide 3</div>
  </AutoPlaySwipeableViews>
);

export default AutoPlayView;

Swipeable View with Indicators

This code demonstrates a swipeable view with pagination indicators. Users can see which slide they are on and navigate to a specific slide using the indicators.

import React from 'react';
import SwipeableViews from 'react-swipeable-views';
import { virtualize } from 'react-swipeable-views-utils';
import { Pagination } from 'react-swipeable-views-utils';

const VirtualizeSwipeableViews = virtualize(SwipeableViews);

const SwipeableViewWithIndicators = () => {
  const [index, setIndex] = React.useState(0);

  const handleChangeIndex = (index) => {
    setIndex(index);
  };

  return (
    <div>
      <VirtualizeSwipeableViews index={index} onChangeIndex={handleChangeIndex}>
        <div>Slide 1</div>
        <div>Slide 2</div>
        <div>Slide 3</div>
      </VirtualizeSwipeableViews>
      <Pagination dots={3} index={index} onChangeIndex={handleChangeIndex} />
    </div>
  );
};

export default SwipeableViewWithIndicators;

Other packages similar to react-swipeable-views

Keywords

FAQs

Package last updated on 30 May 2021

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