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

pixcarousel

v1.0.1

Published

A responsive slide viewer with swipeable thumbnail rail, lazy loading and touch support. Zero dependencies.

Readme

PixCarousel

Node.js JavaScript npm version Node.js CI

A responsive slide viewer with swipeable thumbnail rail, lazy loading, keyboard navigation and full touch support. Zero dependencies.

Install

npm install pixcarousel

Quick start

import PixCarousel from 'pixcarousel';
import 'pixcarousel/style.css';

const nav = new PixCarousel(document.getElementById('my-slider'), {
  slides: [
    { src: '/img/slide1.jpg', thumbSrc: '/img/thumb1.jpg', alt: 'Virginia map' },
    { src: '/img/slide2.jpg', thumbSrc: '/img/thumb2.jpg', alt: 'Alaska overview' },
    { src: '/img/slide3.jpg', alt: 'Alaska outline' },
  ],
});

HTML markup

Just an empty container — the library renders everything inside it:

<div id="my-slider" style="max-width: 800px;"></div>

Using inline HTML / SVG slides

Pass html (for the main slide) and thumbHtml (for the thumbnail) instead of src:

new PixCarousel(el, {
  slides: [
    {
      html: `<svg viewBox="0 0 760 428">...</svg>`,
      thumbHtml: `<svg viewBox="0 0 110 70">...</svg>`,
      label: 'Virginia map',
    },
  ],
});

Options

| Option | Type | Default | Description | |-----------------|------------|---------|-------------| | slides | Slide[] | [] | Array of slide descriptors (see below) | | initialIndex | number | 0 | Starting slide index | | showDots | boolean | true | Show dot indicators below the main stage | | showCounter | boolean | true | Show "1 / N" badge in top-right corner | | showArrows | boolean | true | Show prev / next arrow buttons | | keyboard | boolean | true | Enable ← → arrow key navigation | | loop | boolean | false | Loop from last slide back to first | | accentColor | string | #E8722A | Override accent colour (any CSS value) | | onChange | function | null | (index: number) => void called on every change |

Slide descriptor

| Field | Type | Description | |-------------|----------|-------------| | src | string | Image URL — lazy loaded via IntersectionObserver | | alt | string | Alt text for the image | | html | string | Raw HTML / SVG string rendered in the slide | | thumbSrc | string | Thumbnail image URL (falls back to src) | | thumbHtml | string | Raw HTML / SVG string rendered in the thumbnail | | label | string | Accessible label for aria attributes |

API

nav.goTo(2);          // jump to slide index 2
nav.next();           // next slide
nav.prev();           // previous slide
nav.currentIndex;     // → number
nav.length;           // → total slides
nav.destroy();        // tear down and remove all listeners

Customisation via CSS variables

Override on the root element or any ancestor:

#my-slider {
  --sn-accent: #0070f3;      /* active dot, thumb border */
  --sn-thumb-w: 130px;       /* thumbnail width */
  --sn-thumb-h: 80px;        /* thumbnail height */
  --sn-transition: 0.3s ease;
}

Usage in React

import { useEffect, useRef } from 'react';
import PixCarousel from 'pixcarousel';
import 'pixcarousel/style.css';

export default function MySlider({ slides }) {
  const ref = useRef(null);
  const navRef = useRef(null);

  useEffect(() => {
    navRef.current = new PixCarousel(ref.current, { slides });
    return () => navRef.current.destroy();
  }, [slides]);

  return <div ref={ref} style={{ maxWidth: 800 }} />;
}

Usage in Vue 3

<template>
  <div ref="el" style="max-width: 800px" />
</template>

<script setup>
import { ref, onMounted, onUnmounted } from 'vue';
import PixCarousel from 'pixcarousel';
import 'pixcarousel/style.css';

const el = ref(null);
let nav;

onMounted(() => {
  nav = new PixCarousel(el.value, {
    slides: [/* ... */],
    loop: true,
  });
});
onUnmounted(() => nav?.destroy());
</script>

Usage via CDN (no bundler)

<link rel="stylesheet" href="https://unpkg.com/pixcarousel/dist/style.css" />
<script src="https://unpkg.com/pixcarousel/dist/pixcarousel.umd.js"></script>
<script>
  const { PixCarousel } = window.PixCarousel;
  new PixCarousel(document.getElementById('slider'), { slides: [...] });
</script>

License

MIT