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

@alsandre/responsive-image-carousel

v0.1.27

Published

A responsive image carousel for React applications. The component use props to be managed dynamically. Every single prop is optional, but at least one of two, children or images list, should be provided for the component to be rendered. Carousel is headle

Downloads

13

Readme

Responsive Image Carousel

A responsive image carousel for React applications. The component use props to be managed dynamically. Every single prop is optional, but at least one of two, children or images list, should be provided for the component to be rendered. Carousel is headless meaning it does not have any styling, just basics. To make it appealing there are some props that target different parts of the component. For example className prop is used to attach class to the wrapper div, alternatively style prop can be used to pass styles object that will also be applied to wrapper div. Aside from wrapper if slides are passed as list of images imageClass can be used to attach class to the underling image tag, the other case if children are passed to carousel they can be pre-styled and the component will handle rendering them in carousel. For animation purposes slideAnimation prop can be used which would apply animation to slides. For controlling slider speed sliderSpeed prop is used. The carousel has auto, manual and mixed modes, by default auto mode is enabled. In case of mixed mode carousel stops whiled hovered and if optional controls are enabled can be navigated using chevron buttons, alternatively icon for navigation can be provided via buttonIcon prop and button styling can be adjusted via btnClassName prop. By default component renders 3 slides per screen this behavior can be controlled through slidesPerScreen prop, which accepts numbers from 1 to any. As mentioned above slides can be provided as list of images or as children of compoenent, for passing in as a list imageList prop is used, otherwise wrap the component around list of elements and they will be regarded as children, more commonly list of elements will be passed as dynamic array or directly mapped inside JSX.

Installation

To install the package, run:

yarn add @alsandre/responsive-image-carousel

Usage

import React from "react";
import { Carousel } from "@alsandre/responsive-image-carousel";

const IMAGE_LIST = [
  { imageURL: "https://picsum.photos/800/400?random=1" },
  { imageURL: "https://picsum.photos/800/400?random=2" },
  { imageURL: "https://picsum.photos/800/400?random=3" },
  { imageURL: "https://picsum.photos/800/400?random=4" },
  { imageURL: "https://picsum.photos/800/400?random=5" },
  { imageURL: "https://picsum.photos/800/400?random=6" },
  { imageURL: "https://picsum.photos/800/400?random=7" },
];

function App() {
  return (
    <Carousel>
      {IMAGE_LIST.map((item, index) => (
        <img
          key={index}
          style={{ width: "100%", height: "100%" }}
          src={item.imageURL}
          alt=""
        />
      ))}
    </Carousel>
  );
}

export default App;

Running the Demo

  1. To run the demo locally, navigate to demo directory:
cd ./demo
  1. Install dependencies:
yarn install
  1. Start the demo:
yarn start

This will run the app in development mode. Open http://localhost:3000 to view it in the browser.