npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-fancy-circular-carousel

v1.0.8

Published

Interactive circular carousel with image elements highly customisable as per the developer's needs

Downloads

142

Readme

Features

Try the demo here.

  • Circular image carousel
  • Everything you see is customisable
  • Get focus element to add in your own components
  • Smooth, easy to implement, fantastic UI

Installation

$ npm install react-fancy-circular-carousel

Include the styles by importing FancyCarousel.css

import 'react-fancy-circular-carousel/FancyCarousel.css';

Quickstart

Parameters

| Parameter | Type | Description | |:---|:---|:---| | images | String[] | mandatory List of image sources | | setFocusElement | Function | optional SetState method to get focus element in parent component | | offsetAngle | Number | optional Angle in degrees to offset the carousel elements | | carouselRadius | Number | optional Carousel radius in px | | centralImageRadius | Number | optional Central image radius in px | | centralImageBoxShadow | String | optional Central image box shadow property | | peripheralImageRadius | Number | optional Peripheral Image radius in px | | peripheralImageBoxShadow | String | optional Peripheral image box shadow property | | focusElementStyling | React.CSSProperties | optional Custom styling for the element in focus | | border | Boolean | optional Enable/disable bordering | | borderWidth | Number | optional Border stroke width property in px | | borderHexColor | String | optional Border hex color as a string excluding the '#' | | autoRotateTime | Number | optional Time in seconds for an auto rotating carousel | | transitionTime | Number | optional Time in seconds for the rotating transition | | navigationTextSize | Number | optional ↓ Arrow font size in rem | | navigationButtonRadius | Number | optional Navigation button radius in px | | navigationButtonColor | String | optional ↓ Arrow hex color as a string excluding the '#' | | navigationButtonBgColor | String | optional Navigation button hex color as a string excluding the '#' | | navigationButtonStyling | React.CSSProperties | optional Custom styling for navigation buttons |

Usage


import React from "react";

import FancyCarousel from "react-fancy-circular-carousel";
import 'react-fancy-circular-carousel/FancyCarousel.css';

import image1 from './assets/image1.png';
import image2 from './assets/image2.png';
import image3 from './assets/image3.png';
import image4 from './assets/image4.png';

const YourComponent = () => (

  const images = [image1, image2, image3, image4];

  return <div className="carousel">
    <FancyCarousel images={images} />
  </div>
);

export default YourComponent;

Retrieve focus element

Utility using which one can know which element is currently at focus and may add relevant components around it.

For eg. if the carousel portrays images of cities, this feature may help you update the description in the information box along side the carousel.

import React, { useState } from "react";

import FancyCarousel from "react-fancy-circular-carousel";
import 'react-fancy-circular-carousel/FancyCarousel.css';

import image1 from './assets/image1.png';
import image2 from './assets/image2.png';
import image3 from './assets/image3.png';
import image4 from './assets/image4.png';

const YourComponent = () => (

  // the focus element would be the array index of the image currently at focus
  const [focusElement, setFocusElement] = useState(0);

  const images = [image1, image2, image3, image4];
  const info = ['Delhi', 'Mumbai', 'Bengaluru', 'Kolkata'];

  return <div className="carousel">
      <FancyCarousel images={images} setFocusElement={setFocusElement}/>
      <div className="info-box-wrapper">
        <p> {info[focusElement]} </p>
      </div>
    <div>
);

export default YourComponent;

Customisations

Customise the carousel to your needs such as modifying the carousel size, image size, adding styling such as drop shadow, adding auto rotate, etc

The focusElementStyling and navigationButtonStyling props are of type React.CSSProperties, which is essentially a JavaScript object containing camelcased CSS properties and their corresponding values.

To know more check the official documentation here.

import React from "react";

import FancyCarousel from "react-fancy-circular-carousel";
import 'react-fancy-circular-carousel/FancyCarousel.css';

import image1 from './assets/image1.png';
import image2 from './assets/image2.png';
import image3 from './assets/image3.png';
import image4 from './assets/image4.png';

const YourComponent = () => (

  const images = [image1, image2, image3, image4];

  return <div className="carousel">
    <FancyCarousel 
      images={images} 
      carouselRadius={400}
      peripheralImageRadius={100}
      centralImageRadius={200}
      focusElementStyling={{border: '2px solid #ba4949'}}
      autoRotateTime={3}
      borderWidth={4}
      borderHexColor={'1c364f'}
    />
  </div>
);

export default YourComponent;

Preview

With navigators

Preview Image

With auto rotation

Preview Gif

Github Repo

Github Repo
Try it out for yourselves and ⭐ the repo if you like it!

License

MIT © Ninad Sutrave