3D Slider

A responsive cascaded card slider driven by direct DOM transforms - wheel, drag, and touch without re-rendering on every frame. Pass items or use the bundled demo images.

Default

Cascaded stack with rotate + translate. Scroll the wheel or drag to scrub; click a card to snap it to center.

Loading…

Installation

CLI
npx @sonojs/ui@latest add 3d-slider

Usage

Demo images install under components/carousels/3d-slider/images/ and are imported by the defaults. Pass your own items when you replace them.

page.tsx
"use client"

import { ThreeDSlider } from "@/components/carousels/3d-slider"

export default function Page() {
  return <ThreeDSlider className="w-full" />
}

Props

PropTypeDefaultDescription
itemsThreeDSliderItem[]bundled imagesCards with `title`, `num`, and `imageUrl`. Defaults to static imports from `./images/`.
speedWheelnumber0.04Wheel delta multiplier.
speedDragnumber-0.15Drag delta multiplier (typically negative).
onItemClick(item, index) => void-Fires when a card is clicked (also snaps to that card).
containerStyleCSSProperties-Inline styles on the stage.
classNamestring-Extra classes on the stage.