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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jerryshim-ui/carousel

v0.3.0

Published

A headless, accessible React carousel UI built on top of `@jerryshim-ui/flow-carousel` behaviors and data attributes. Ships small, composes with Tailwind or your own CSS.

Readme

@jerryshim-ui/carousel

A headless, accessible React carousel UI built on top of @jerryshim-ui/flow-carousel behaviors and data attributes. Ships small, composes with Tailwind or your own CSS.

Installation

pnpm add @jerryshim-ui/carousel
# or
npm i @jerryshim-ui/carousel
# or
yarn add @jerryshim-ui/carousel

Quick Start

/* global.css */
@import 'tailwindcss';
/* NOTE: The following preset already includes 
   @import '@jerryshim-ui/flow-carousel/preset.css';
   so you don’t need to import it separately. */
@import '@jerryshim-ui/carousel/preset.css';
import '@jerryshim-ui/flow-dom/global';
import {
  Carousel,
  CarouselItem,
  CarouselPrev,
  CarouselNext,
  CarouselIndicators,
  CarouselIndicator,
} from '@jerryshim-ui/carousel';

export default function Example() {
  return (
    <Carousel auto interval={3000} className="relative w-full">
      <div className="relative h-56 overflow-hidden rounded-lg md:h-96">
        <CarouselItem active>
          <img className="block w-full h-full object-cover" src="/img1.jpg" alt="" />
        </CarouselItem>
        <CarouselItem>
          <img className="block w-full h-full object-cover" src="/img2.jpg" alt="" />
        </CarouselItem>
        <CarouselItem>
          <img className="block w-full h-full object-cover" src="/img3.jpg" alt="" />
        </CarouselItem>
      </div>

      <CarouselPrev aria-label="Previous" />
      <CarouselNext aria-label="Next" />

      <CarouselIndicators>
        <CarouselIndicator to={0} aria-label="Slide 1" />
        <CarouselIndicator to={1} aria-label="Slide 2" />
        <CarouselIndicator to={2} aria-label="Slide 3" />
      </CarouselIndicators>
    </Carousel>
  );
}

API

All components are client-side React components.

export type CarouselProps = React.HTMLAttributes<HTMLDivElement> & {
  id?: string;
  auto?: boolean; // enable auto slide when true
  interval?: number; // ms, default 3000
};
export const Carousel: React.FC<CarouselProps>;

export type CarouselItemProps = React.HTMLAttributes<HTMLDivElement> & {
  active?: boolean; // mark initial active slide
};
export const CarouselItem: React.FC<CarouselItemProps>;

export type CarouselPrevProps = React.ButtonHTMLAttributes<HTMLButtonElement>;
export const CarouselPrev: React.FC<CarouselPrevProps>;

export type CarouselNextProps = React.ButtonHTMLAttributes<HTMLButtonElement>;
export const CarouselNext: React.FC<CarouselNextProps>;

export type CarouselIndicatorProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
  to: number; // zero-based slide index
};
export const CarouselIndicator: React.FC<CarouselIndicatorProps>;

export type CarouselIndicatorsProps = React.HTMLAttributes<HTMLDivElement>;
export const CarouselIndicators: React.FC<CarouselIndicatorsProps>;

Most components support an asChild prop (via @jerryshim-ui/primitives/Slot) to render as a custom element while preserving behavior and props: Carousel, CarouselItem, CarouselPrev, CarouselNext, CarouselIndicator. CarouselIndicators does not support asChild.

Options and Data Attributes

  • auto: When true, Carousel sets data-carousel="slide"; otherwise "static".
  • interval: Milliseconds between auto slides; emitted as data-carousel-interval="<ms>".
  • CarouselItem: Adds data-carousel-item="active" when active is true; empty string otherwise.
  • CarouselPrev: Adds data-carousel-prev.
  • CarouselNext: Adds data-carousel-next.
  • CarouselIndicator: Adds data-carousel-slide-to="<index>" where <index> is zero-based.

These attributes are consumed by @jerryshim-ui/flow-carousel under the hood.

Usage Patterns

  • Custom render element with asChild:
<Carousel asChild>
  <section />
</Carousel>
  • Controlled initial slide via active on a single CarouselItem:
<Carousel>
  <CarouselItem active>First</CarouselItem>
  <CarouselItem>Second</CarouselItem>
  <CarouselItem>Third</CarouselItem>
  <CarouselPrev />
  <CarouselNext />
  <CarouselIndicators>
    <CarouselIndicator to={0} />
    <CarouselIndicator to={1} />
    <CarouselIndicator to={2} />
  </CarouselIndicators>
</Carousel>

Accessibility

  • Provide aria-label on navigation buttons and indicators.
  • Images should include alt text.
  • Focus styles are not overridden; customize via className.

Styling

Components ship minimal utility classes for layout/positioning. Bring your own styles (e.g., Tailwind) via className.

  • Container: defaults to relative w-full.
  • Items: default hidden duration-700 ease-in-out.
  • Controls: positioned at sides with full-height clickable area.
  • Indicators wrapper: bottom-centered row.

Integration & Lifecycle

  • Carousel imports @jerryshim-ui/flow-dom/global once and calls initCarousels() from @jerryshim-ui/flow-carousel on mount; it returns a disposer that runs on unmount and re-runs when the id changes.
  • This package is browser-only. On SSR, render markup; interactivity attaches on the client.

TypeScript

Full TypeScript typings are bundled via types export. All components forward refs to their underlying elements.

Versioning & Breaking Changes

See CHANGELOG.md in the repository root or package subfolder when available.

License

MIT

Build Format Change

As of version 0.3.0, the build output now includes "use client" at the top of client components by default. This ensures proper client-side rendering without requiring manual insertion.