Convert Figma logo to code with AI

FormidableLabs logonuka-carousel

Small, fast, and accessibility-first React carousel library with an easily customizable UI and behavior to fit your brand and site.

3,052
593
3,052
25

Top Related Projects

28,370

the last carousel you'll ever need

7,271

A dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more

39,523

Most modern mobile touch slider with hardware accelerated transitions

React carousel component

React.js Responsive Carousel (with Swipe)

Quick Overview

Nuka Carousel is a React-based carousel component that offers a flexible and customizable solution for creating image sliders and content carousels. It provides smooth animations, responsive design, and supports both mouse and touch interactions, making it suitable for various web applications.

Pros

  • Highly customizable with numerous configuration options
  • Supports both horizontal and vertical orientations
  • Offers smooth animations and transitions
  • Compatible with server-side rendering

Cons

  • Learning curve for advanced customizations
  • Some users report occasional performance issues with large datasets
  • Documentation could be more comprehensive for complex use cases

Code Examples

Basic usage:

import Carousel from 'nuka-carousel';

function MyCarousel() {
  return (
    <Carousel>
      <img src="image1.jpg" alt="Slide 1" />
      <img src="image2.jpg" alt="Slide 2" />
      <img src="image3.jpg" alt="Slide 3" />
    </Carousel>
  );
}

Customizing controls:

<Carousel
  renderCenterLeftControls={({ previousSlide }) => (
    <button onClick={previousSlide}>Previous</button>
  )}
  renderCenterRightControls={({ nextSlide }) => (
    <button onClick={nextSlide}>Next</button>
  )}
>
  {/* Carousel content */}
</Carousel>

Autoplay and wrap-around:

<Carousel
  autoplay={true}
  wrapAround={true}
  autoplayInterval={3000}
>
  {/* Carousel content */}
</Carousel>

Getting Started

  1. Install the package:

    npm install nuka-carousel
    
  2. Import and use in your React component:

    import Carousel from 'nuka-carousel';
    
    function App() {
      return (
        <Carousel>
          <img src="image1.jpg" alt="Slide 1" />
          <img src="image2.jpg" alt="Slide 2" />
          <img src="image3.jpg" alt="Slide 3" />
        </Carousel>
      );
    }
    
    export default App;
    
  3. Customize as needed using props and configuration options. Refer to the documentation for advanced usage and available props.

Competitor Comparisons

28,370

the last carousel you'll ever need

Pros of Slick

  • Wider browser compatibility, including older versions of Internet Explorer
  • More extensive customization options and built-in themes
  • Larger community and ecosystem, with numerous plugins and extensions available

Cons of Slick

  • Relies on jQuery, which may increase bundle size and affect performance
  • Less suitable for modern React-based applications
  • Maintenance has slowed down in recent years, with fewer updates

Code Comparison

Slick (jQuery-based):

$('.carousel').slick({
  dots: true,
  infinite: true,
  speed: 500,
  slidesToShow: 3,
  slidesToScroll: 1
});

Nuka Carousel (React-based):

<Carousel>
  <img src="image1.jpg" alt="Slide 1" />
  <img src="image2.jpg" alt="Slide 2" />
  <img src="image3.jpg" alt="Slide 3" />
</Carousel>

Summary

Slick is a more established and feature-rich carousel library with broader browser support, making it suitable for projects that require extensive customization or compatibility with older browsers. However, its reliance on jQuery and slower maintenance cycle may be drawbacks for modern web applications.

Nuka Carousel, on the other hand, is built specifically for React applications, offering a more streamlined and performant solution for projects already using React. It has a simpler API and is actively maintained, but may lack some of the advanced features and extensive customization options found in Slick.

7,271

A dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more

Pros of Glide

  • Lightweight and dependency-free, resulting in smaller bundle sizes
  • Supports both JavaScript and CSS-only implementations
  • Offers more customization options and event hooks

Cons of Glide

  • Less React-specific features compared to Nuka Carousel
  • May require more manual setup for React integration
  • Documentation could be more comprehensive for complex use cases

Code Comparison

Glide (vanilla JavaScript):

new Glide('.glide').mount()

Nuka Carousel (React):

<Carousel>
  {slides.map((slide, index) => (
    <img key={index} src={slide} alt={`Slide ${index + 1}`} />
  ))}
</Carousel>

Glide focuses on a more flexible, framework-agnostic approach, while Nuka Carousel is tailored specifically for React applications. Glide's implementation is simpler and more lightweight, but Nuka Carousel offers more React-specific features out of the box. The choice between the two depends on the project's requirements, with Glide being more suitable for vanilla JavaScript or multi-framework projects, and Nuka Carousel being a better fit for React-centric applications.

39,523

Most modern mobile touch slider with hardware accelerated transitions

Pros of Swiper

  • More feature-rich with advanced effects like 3D transitions and parallax
  • Better performance, especially for mobile devices
  • Wider browser compatibility, including older versions

Cons of Swiper

  • Larger file size due to more features
  • Steeper learning curve for advanced customizations
  • Less React-specific optimization compared to Nuka Carousel

Code Comparison

Swiper initialization:

const swiper = new Swiper('.swiper-container', {
  slidesPerView: 3,
  spaceBetween: 30,
  pagination: {
    el: '.swiper-pagination',
    clickable: true,
  },
});

Nuka Carousel initialization:

<Carousel
  slidesToShow={3}
  cellSpacing={30}
  renderBottomCenterControls={({ currentSlide }) => (
    <div className="carousel-dots">{/* Custom pagination */}</div>
  )}
>
  {/* Slides */}
</Carousel>

Swiper offers a more traditional JavaScript approach with configuration options, while Nuka Carousel provides a React-specific component with props for customization. Swiper's initialization is more concise, but Nuka Carousel's React integration allows for easier state management and component-based development in React applications.

React carousel component

Pros of react-slick

  • More comprehensive documentation with detailed API explanations
  • Wider range of customization options and features
  • Larger community and more frequent updates

Cons of react-slick

  • Heavier bundle size due to additional dependencies
  • Steeper learning curve for complex configurations

Code Comparison

react-slick:

import React from "react";
import Slider from "react-slick";

const SimpleSlider = () => {
  const settings = {
    dots: true,
    infinite: true,
    speed: 500,
    slidesToShow: 1,
    slidesToScroll: 1
  };
  return (
    <Slider {...settings}>
      <div><h3>1</h3></div>
      <div><h3>2</h3></div>
      <div><h3>3</h3></div>
    </Slider>
  );
}

nuka-carousel:

import React from "react";
import Carousel from "nuka-carousel";

const SimpleCarousel = () => {
  return (
    <Carousel>
      <img src="image1.jpg" alt="Slide 1" />
      <img src="image2.jpg" alt="Slide 2" />
      <img src="image3.jpg" alt="Slide 3" />
    </Carousel>
  );
}

Both libraries offer easy-to-use carousel components, but react-slick provides more configuration options out of the box. nuka-carousel has a simpler API, which can be advantageous for basic use cases. The choice between the two depends on the specific requirements of your project and the level of customization needed.

React.js Responsive Carousel (with Swipe)

Pros of react-responsive-carousel

  • More customizable with a wider range of options and settings
  • Better support for touch devices and swipe gestures
  • Includes built-in responsive design features

Cons of react-responsive-carousel

  • Larger bundle size, which may impact performance
  • Less frequent updates and maintenance compared to nuka-carousel
  • Steeper learning curve due to more complex API

Code Comparison

react-responsive-carousel:

<Carousel showArrows={true} infiniteLoop={true} autoPlay={true}>
  <div>
    <img src="image1.jpg" alt="Image 1" />
    <p className="legend">Legend 1</p>
  </div>
  <div>
    <img src="image2.jpg" alt="Image 2" />
    <p className="legend">Legend 2</p>
  </div>
</Carousel>

nuka-carousel:

<Carousel wrapAround={true} autoplay={true}>
  <img src="image1.jpg" alt="Image 1" />
  <img src="image2.jpg" alt="Image 2" />
</Carousel>

The code comparison shows that react-responsive-carousel offers more built-in features like legends and arrows, while nuka-carousel has a simpler API. react-responsive-carousel requires wrapping content in div elements, whereas nuka-carousel allows direct use of img tags as children.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Nuka Carousel

Maintenance Status

Small, fast and accessibility-first React carousel library with easily customizable UI and behavior to fit your brand and site

Nuka Carousel Animated Example

Install

To add nuka-carousel to your project run the following command in your project folder.

$ yarn add nuka-carousel

Come learn more and see a live demo at our docs site!

Support

Have a question about nuka-carousel? Submit an issue in this repository using the "Question" template.

Notice something inaccurate or confusing? Feel free to open an issue or make a pull request to help improve the documentation for everyone!

The source for our docs site lives in this repo in the docs folder.

Contributing

See the Contribution Docs.

Maintenance Status

Active: Nearform is actively working on this project, and we expect to continue for work for the foreseeable future. Bug reports, feature requests and pull requests are welcome.

NPM DownloadsLast 30 Days