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

@codelytv/react-carousel

v1.0.3

Published

<p align="center"> <a href="https://codely.com"> <img src="https://user-images.githubusercontent.com/10558907/170513882-a09eee57-7765-4ca4-b2dd-3c2e061fdad0.png" width="300px" height="92px" alt="Codely logo"/> </a> </p>

Downloads

45

Readme

✨ Features

  • Automagically responsive:
    • Any size: no need to set a specific size via props
    • Multiple items: no need to set the number of items per "page"
  • Supports images, videos, everything: each direct child is a slide
  • Scroll based: works on mobile or trackpad
  • Control buttons
  • Custom styling
  • Accessible by default
  • Show next/previous items partially
  • Works with server-side rendering

👀 Demos

View the full Storybook documentation.

⚙️ How to use

  1. Install the dependency
    npm install @codelytv/react-carousel
    or
    yarn @codelytv/react-carousel
  2. Import and use:
      import { Carousel } from "@codelytv/react-carousel"
    <Carousel>
      <div>A simple slide</div>
      <div><img src="https://placekitten.com/500/500" alt="a slide can contain anything" /></div>
      <article>
        <h2>It can be any tag</h2>
        <p>and contain any number of items</p>
      </article>
    </Carousel>
    The carousel automatically detects the size of each slide and when navigating via buttons, it will scroll smoothly until the first not visible slide is in view.

🎛️ Props

| Name | Value | Default | Description | | -------------------------------- | ------------------- | --------------------------- | --------------------------- | | prevButtonContent | React.ReactNode | <ArrowLeft /> | The HTML content of the previous navigation button | | nextButtonContent | React.ReactNode | <ArrowRight /> | The HTML content of the next navigation button | | prevAriaLabel | string | "Previous" | Defines the previous navigation button aria-label attribute. Useful when the button content is an element without accessible text. | | nextAriaLabel | string | "Next" | Defines the previous navigation button aria-label attribute. Useful when the button content is an element without accessible text. |

🎨 Styling

There are some CSS Variables that will help you style the carousel:

| Name | Default | Description | | -------------------------------- | ------------------- | --------------------------------------------- | | --slider-gap | 0 | Sets the gap between slides | | --slider-nav-margin-top | 0.5rem | Sets the top margin of the navigation buttons | | --slider-button-width | 2.5rem | Sets the navigation buttons width | | --slider-button-height | 2.5rem | Sets the navigation buttons height | | --slider-button-padding | 0.2rem | Sets the padding of the navigation buttons |

If this is not enough, you can always style via CSS classes. They all have low specificity so they are easy to overwrite, but be careful, changing this elements could cause the carousel to break. Try to limit the changes to colors, background, etc. to prevent unexpected results.

| Class | Description | | --------------------- | -------------------------------------- | | .carousel | The main carousel wrapper | | .carousel__slider | The carousel scroller | | .carousel__slide | The wrapper for each slide | | .carousel__nav | The wrapper for the navigation buttons | | .carousel__button | The navigation buttons |

🤝 Contributing

📚 Run

  • npm run build: Compiles the Carousel package
  • npm run storybook: Opens Storybook documentation with all of the Carousel demos

✅ Testing

npm run test: Run unit tests with Jest and React Testing Library

🔦 Linting

  • npm run lint: Run linter
  • npm run lint:fix: Fix lint issues

👌 Codely Code Quality Standards

Publishing this package we are committing ourselves to the following code quality standards:

  • 🤝 Respect Semantic Versioning: No breaking changes in patch or minor versions
  • 🤏 No surprises in transitive dependencies: Use the bare minimum dependencies needed to meet the purpose
  • 🎯 One specific purpose to meet without having to carry a bunch of unnecessary other utilities
  • Tests as documentation and usage examples
  • 📖 Well documented ReadMe showing how to install and use
  • ⚖️ License favoring Open Source and collaboration