New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-draggable-slider

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-draggable-slider

Smooth draggable React slider for project items using Spring and GSAP

latest
npmnpm
Version
0.1.6
Version published
Weekly downloads
17
Maintainers
1
Weekly downloads
 
Created
Source

react-draggable-slider

GitHub

Smooth Draggable React Slider using React Spring and GSAP for animations.

gif gif2

Installation

npm install react-draggable-slider --save-dev

Demo

https://sanderdebr.github.io/react-draggable-slider/

Edit agitated-christian-rlg5j

Usage

Add <Slider /> component with sliderSettings object, the only required setting an array of slider items.

import { Slider } from "react-draggable-slider";
import { projectList } from "./data";

function App() {
  const sliderSettings = {
    data: projectList,
    speed: 3000,
    easing: "elastic",
    bgColor: "rgba(255, 255, 255, 0.05)",
    buttonHref: "https://www.google.com",
    buttonTarget: "_self",
    buttonText: "View project",
    showButton: true,
  };
  return <Slider sliderSettings={sliderSettings} />;
}

Use the following structure for your slider items:

export const projectList = [
  {
    title: "Cutting Edge Project",
    image: "https://source.unsplash.com/collection/347317/",
    description: "Praesent quis congue nisi...",
  },
  {
    title: "Featured Artist 3D",
    image: "https://source.unsplash.com/collection/3573299/",
    description: "Duis at tellus vitae velit aliquet varius...",
  },
];

Note: although the above example uses hooks, react-draggable-slider is compatible with Class-based components. However, since it internally uses hooks, it requires React 16.8+.

Props

The sliderSettings prop in <Slider sliderSettings={sliderSettings} /> component accepts the following props:

NameTypeDescriptionDefault Value
dataarrayarray of slider items, see below which structure you may use[]
speednumberspeed of sliding to next item when dragged in milliseconds3000 (3 seconds)
easingstring4 available GSAP easings to animate the sliding: "power", "back", "elastic", "expo".ease
bgColorstringSet background-color of the whole slider, accepts HEX and RGB(A).rgba(255, 255, 255, 0.05)
buttonTextstringText inside button per itemView case study
showButtonbooleanIf a button should be shown for all itemstrue

Using

  • React Spring
  • GSAP
  • Styled Components

Keywords

react

FAQs

Package last updated on 17 Jun 2020

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