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

@tgoliveira/horizontal-carousel

v0.1.1

Published

Accessible horizontal carousel with arrows, drag, and dwell-to-grab UX

Readme

@tgoliveira/horizontal-carousel

Horizontal carousel for React with arrow navigation, pointer drag, and dwell-to-grab UX.

Extracted from liqsense.

Install

npm install @tgoliveira/horizontal-carousel

Peer dependencies: react and react-dom (v18+).

This component uses Tailwind CSS utility classes. Your app must include Tailwind and scan the package source (or dist) so those classes are generated:

@import "tailwindcss";
@source "../node_modules/@tgoliveira/horizontal-carousel/dist";

When linking the library from a monorepo path, point @source at the package src/ or dist/ folder instead.

Critical layout styles (overflow, flex, slide width) are also set inline so the carousel remains functional even if a few utility classes are missing.

Usage

"use client";

import {
  HorizontalCarousel,
  useCarouselVisibleCount,
  CAROUSEL_ATTR_INTERACTIVE,
} from "@tgoliveira/horizontal-carousel";

type Item = { id: string; title: string };

const items: Item[] = [
  { id: "1", title: "Slide 1" },
  { id: "2", title: "Slide 2" },
  { id: "3", title: "Slide 3" },
];

export function ExampleCarousel() {
  const visibleCount = useCarouselVisibleCount(3, 1);

  return (
    <HorizontalCarousel
      items={items}
      visibleCount={visibleCount}
      getItemKey={(item) => item.id}
      renderSlide={(item) => (
        <div className="rounded-lg border border-zinc-200 p-4">
          <h3>{item.title}</h3>
          <button type="button" {...{ [CAROUSEL_ATTR_INTERACTIVE]: "" }}>
            Action
          </button>
        </div>
      )}
    />
  );
}

Interaction model

  • Arrows — appear when more slides exist off-screen.
  • Drag — horizontal pointer drag snaps one slide at a time (8px start threshold, 48px snap).
  • Dwell-to-grab — after ~350ms on a free slide area, the cursor switches to grab; quick taps still propagate to slide content.
  • Interactive zones — mark buttons/links inside slides with data-carousel-interactive so they keep pointer cursor and do not start a drag.

API

HorizontalCarousel<T>

| Prop | Type | Description | |------|------|-------------| | items | T[] | Slide data | | visibleCount | number | Slides visible at once | | getItemKey | (item, index) => string | Stable React key | | renderSlide | (item, index) => ReactNode | Slide content | | className | string? | Root wrapper classes | | slideClassName | string? | Per-slide wrapper classes | | prevArrowLabel | string? | Accessible label for left arrow | | nextArrowLabel | string? | Accessible label for right arrow |

useCarouselVisibleCount(visibleLg, visibleSm, breakpointPx?)

Returns visibleLg at min-width: breakpointPx (default 1024), otherwise visibleSm.

Utilities

  • carouselMaxOffset, carouselDragStep, carouselDragStarted — math helpers
  • isCarouselInteractiveTarget — DOM helper for interactive zones
  • CAROUSEL_ATTR_* — data attribute names and tuning constants

Development

npm install
npm run validate   # typecheck, lint, tests + coverage, build
npm test
npm run build

Consumer demo

Local Vite app under examples/consumer-demo/ (not published with the package):

npm run demo:dev

See examples/consumer-demo/README.md.

See CONTRIBUTING.md for branch, PR, and release workflow.

License

MIT