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

imageslider-next

v1.3.2

Published

Simple image slider component with left to right slide animation.

Readme

imageslider-next

A small, framework-agnostic image slider component built with Tailwind CSS and TypeScript. This package now supports passing a custom image component (for example, Next.js Image) so you can enable optimized images inside Next.js projects.

Install

npm i imageslider-next
# or
pnpm add imageslider-next

Features

  • Lightweight, accessible image slider.
  • Accepts a custom ImageComponent (e.g. next/image) for optimized images.
  • imageProps forwarding for responsive behavior (e.g. sizes, priority, objectFit).
  • Responsive native <img> fallback when no ImageComponent is provided.
  • Fixed: each slider instance is independent; controls no longer collide across multiple instances.

Basic usage

import ImageSliderNext from 'imageslider-next';

const data = [
  { id: 1, imageUrl: '/images/1.jpg', title: 'One', alt: 'One', width: 1200, height: 800 },
  { id: 2, imageUrl: '/images/2.jpg', title: 'Two', alt: 'Two', width: 1200, height: 800 },
  { id: 3, imageUrl: '/images/3.jpg', title: 'Three', alt: 'Three', width: 1200, height: 800 },
];

<ImageSliderNext
  data={data}
  sliderClassName="w-full shadow-md h-64 sm:h-80 rounded-lg"
  slideClassName=""
  buttonClassName="w-3 h-3 rounded-full bg-black/50"
  imageWidth={1200}
  imageHeight={800}
/>

Using Next.js Image for optimization

If you use Next.js, pass Image as the ImageComponent prop and optionally forward imageProps to enable responsive loading. Example:

import Image from 'next/image';
import ImageSliderNext from 'imageslider-next';
import img1 from '@/public/1.jpg';

const slides = [
  { id: 1, imageSrc: img1, title: 'First', alt: 'first', width: 1200, height: 800 },
  // ...
];

<ImageSliderNext
  data={slides}
  sliderClassName="w-full shadow-md h-[50vh] rounded-lg"
  ImageComponent={Image}
  imageProps={{ sizes: '100vw', priority: true }}
  imageWidth={1200}
  imageHeight={800}
/>

Notes:

  • We intentionally strip fill: true when forwarded to avoid layout issues inside the slider (the slider manages layout). If you need fill behavior, you can implement a wrapper with an explicit aspect ratio on your slide.
  • Provide width/height per item or use imageWidth/imageHeight defaults to help the component calculate correct sizes.

Storybook

To run the component locally with Storybook:

npm run storybook
# or
pnpm storybook

There are example stories that show a native <img> fallback and usage with a mock Image component. Use the With Image Component story to test integration.

Hosted Storybook: https://imageslider-next.vercel.app/

TypeScript / image imports

If your TypeScript setup complains about importing image files, add a simple declaration file src/types/images.d.ts:

declare module '*.jpg';
declare module '*.png';
declare module '*.svg';
declare module '*.webp';
declare module '*.avif';

Also, for local development you may want to add React type declarations if you see missing types:

npm install -D @types/react @types/react-dom

API

ImageSliderNext props (high level):

  • data: ItemData[] — items to render. Each item supports imageUrl, imageSrc (imported images), title, alt, width, height.
  • sliderClassName: string — classes applied to slider root.
  • slideClassName: string — classes applied to each slide.
  • buttonClassName: string — classes applied to pagination buttons.
  • imageWidth?: number, imageHeight?: number — defaults used when per-item sizes missing.
  • ImageComponent?: React.ComponentType<any> — optional image component (pass Next's Image).
  • imageProps?: Record<string, any> — forwarded props for the image component (we strip fill).

Contributing

PRs welcome — please run npm run build and npm run storybook to test changes locally.