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

@mxck/pietile-carousel

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

@mxck/pietile-carousel

React Carousel

  • 3.2.0-beta-0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

npm version minzipped bundle size

React carousel based on Framer Motion without repaints and simple in use.

Features

  • Doesn't require to specify items dimensions (pure css solution)
  • Relies on translates for movements (zero paints)
  • Arbitrary number of visible items
  • Сyclicality

Installation

Using yarn

yarn add pietile-carousel

or using npm

npm install -S pietile-carousel

Pietile Carousel depends on Framer Motion which is a peer dependency so be sure that it's installed in you project (if not then install it using yarn add framer-motion or npm install -S framer-motion)

Usage

Every item is wrapped in container where it can layout it's content. The size of container depends on the size of carousel and amount of visible items. You can use any styling system you want to set styles. Get ref and use moveLeft/moveRight/moveTo methods for scroll.

Example

import React from 'react';

import { PietileCarousel } from 'pietile-carousel';

function App() {
  const carouselStyle = {
    width: 150,
    height: 100,
  };

  const itemStyle = {
    width: '100%',
    height: '100%',
  };

  return (
    <PietileCarousel style={carouselStyle}>
      <div style={{ ...itemStyle, backgroundColor: 'red' }} />
      <div style={{ ...itemStyle, backgroundColor: 'orange' }} />
      <div style={{ ...itemStyle, backgroundColor: 'yellow' }} />
    </PietileCarousel>
  );
}

API

Properties

namedescriptiontypedefault
autoplayIntervalHow often autoplay happens (0 to disable)number0
childrenComponents rendered in carousel (required)Node-
classNameCSS classstring-
countAmount of visible itemsnumber1
draggableAllow dragbooleantrue
marginMargin between itemsnumber0
styleStyle objectObject-
onChangeCallback when index changesFunction-

Methods

namedescription
slideNext()Scroll to next slide
slidePrev()Scroll to previous slide
slideTo(index)Scroll to index

Note

Carousel protects nesting links (a-tag's) from undesirable behavior (link click is being processed when the user starts dragging and release the mouse outside of the carousel) by calling preventDefault for the correspondent click event. If you are handling clicks manually you can check defaultPrevented when processing your event.

License

Pietile Carousel is MIT License.

Keywords

FAQs

Package last updated on 01 Dec 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