Socket
Socket
Sign inDemoInstall

framer-motion-carousel

Package Overview
Dependencies
13
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    framer-motion-carousel

A simple framer motion carousel component for React


Version published
Weekly downloads
1.1K
increased by8.37%
Maintainers
1
Install size
3.13 MB
Created
Weekly downloads
 

Readme

Source

A simple framer-motion-carousel, used for framer-motion, chakra-ui support click and swipe, support custom arrows, dots, easy to use.

Basic Usage

import * as React from "react";
import Carousel from "framer-motion-carousel";

const colors = ["#f90", "#ef0", "#e0f"];

const App = () => (
  <div style={{ width: 600, height: 400 }}>
    <Carousel>
      {colors.map((item, i) => (
        <div
          key={i}
          style={{
            width: "100%",
            height: "100%",
            backgroundColor: colors[i],
          }}
        ></div>
      ))}
    </Carousel>
  </div>
);
export default App;

img element should add draggable=false

<div style={{ width: 600, height: 400, margin: "0 auto" }}>
  <Carousel>
    {[1, 2, 3, 4].map((item, i) => (
      <img
        draggable="false"
        src={`./${item}.jpg`}
        key={i}
        width="100%"
        alt=""
      />
    ))}
  </Carousel>
</div>

Example

Live Demo

example

props

propstypedefaultdescription
loopbooleantrueloop play
autoPlaybooleantrueauto play
intervalnumber2000auto play interval
renderArrowLeft({handlePrev: () => void, activeIndex: number}) => React.ReactNodenullcustom your arrows
renderArrowRight({handleNext: () => void, activeIndex: number}) => React.ReactNodenullcustom your arrows
renderDots({activeIndex: number, setActiveIndex: (index: number) => void;}) => React.ReactNodenullcustom your dots

Development

yarn install

yarn build

Keywords

FAQs

Last updated on 10 Feb 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc