Nuka Carousel: The React Carousel, Rethought and Refined

April 23, 2018

Nuka Carousel is a pure-React carousel component that can support any kind of component as children, including text and images. Nuka Carousel has no built-in design, so it can be styled to fit any app. The carousel navigation can be controlled with either a container component or your app’s state management, making it easy to incorporate into your build.

Nuka Carousel

All-new API for custom controls

Custom components can be added to eight zones along the edge of the carousel. By default, Nuka Carousel displays a previous and next button along with page indicators. The carousel component now has render props for all eight zones (top left, center left, bottom left, etc.) that pass control functions and state to your custom components. For example:

<Carousel renderCenterLeftControls={({ previousSlide }) => ( <button onClick={previousSlide}>Previous</button> )} >

Adaptive Height

Nuka Carousel now supports dynamic height, based on content. There are three optional modes set by a prop: first mode sets the height of the carousel based on the initial slide; max mode enumerates through all the slides and sets the height to the tallest slide; and current mode is dynamic and resizes the carousel based on the content of the current slide.

Nuka First Mode
Nuka Carousel Current Mode
Nuka Carousel Max Mode

Modern tooling and React patterns

Nuka Carousel is now built using Webpack 4, Babel 7, and React 16. Mixins and createReactClass have given way to React.Component and modern React patterns. In addition to CommonJS, Nuka Carousel now has ES module outputs for apps with supporting tooling (e.g., supporting tree shaking for slimmer builds in modern Webpack).

Getting Started

It's easy to integrate Nuka Carousel into any React app- just yarn add nuka-carousel. To learn more about Nuka Carousel’s API or contributing to Nuka Carousel, visit the GitHub page.

Related Posts

Victory Native Turns 40

November 17, 2023
Victory Native XL is a ground-up rewrite of Victory Native that diverges from the Victory Web API to leverage modern tooling in the React Native space to offer peak performance and flexibility.

Empowering Users: Developing Accessible Mobile Apps using React Native

June 26, 2023
Robust technical accessibility strategies and best practices we implemented for a mobile voting application using React Native.

Build a Text Summarizer in 100 Lines of Code with Vercel AI SDK

June 16, 2023
Vercel recently announced their AI SDK. I wanted to see just how easy it was to get up and running with this Vercel AI SDK and build something simple, but with some potential usefulness.