Componentmedia0.93 KB gzipZero dependencies

Image Carousel

Image carousel with arrows, dots and swipe feel.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add image-carousel

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { ImageCarousel } from "@/components/ui/image-carousel"; <ImageCarousel />

Source code

image-carousel.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsximage-carousel.tsx71 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface ImageCarouselProps extends React.HTMLAttributes<HTMLDivElement> {  images: { id: string; src: string; alt?: string }[];  autoPlay?: boolean;  interval?: number;} /** Image carousel slider: nav arrows + dot pagination + autoplay. */export function ImageCarousel({ images = [], autoPlay, interval = 4000, className, ...props }: ImageCarouselProps) {  const [index, setIndex] = React.useState(0);   React.useEffect(() => {    if (!autoPlay || images.length < 2) return;    const t = setInterval(() => setIndex((i) => (i + 1) % images.length), interval);

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { ImageCarousel } from "@/components/ui/image-carousel"; <ImageCarousel />
PropTypeDescription
images{ id: string; src: string; alt?: string }[]Configures images. (Default: [])
autoPlaybooleanToggles auto play.
intervalnumberConfigures interval. (Default: 4000)