Componentmedia0.93 KB gzipZero dependencies
Image Carousel
Image carousel with arrows, dots and swipe feel.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add image-carouselOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { ImageCarousel } from "@/components/ui/image-carousel"; <ImageCarousel />Source code
image-carousel.tsx + 1 helperZero 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 />| Prop | Type | Description |
|---|---|---|
| images | { id: string; src: string; alt?: string }[] | Configures images. (Default: []) |
| autoPlay | boolean | Toggles auto play. |
| interval | number | Configures interval. (Default: 4000) |