AddThisFeature

Image Carousel

Let customers page through a set of images with arrows, dots, and swipe.

moderate Media & Video

What it adds

A horizontally paged row of images with previous and next controls, position indicators, optional autoplay, and touch swiping.

What your agent is told to do

5
  1. 1

    Reserve the slide dimensions before any image loads, using the app's existing aspect-ratio handling if it has one, so the page does not jump as each image arrives.

  2. 2

    If the app already has an image lightbox, wire the carousel into it rather than building a second full-screen viewer. Tapping a slide should open the existing lightbox at the matching index.

  3. 3

    Make the carousel operable without a pointer: arrow keys move between slides, the dots are real focusable controls, and the current position is announced rather than conveyed only by a filled dot.

  4. 4

    Treat autoplay as an interruption the user is allowed to stop. Pause it on hover, on focus anywhere inside the carousel, when the tab is hidden, and permanently when reduced motion is preferred, and provide a visible pause control.

  5. 5

    Do not load every slide upfront. Load the visible slide and the next one, defer the rest, and require alt text on each image rather than shipping a row of unlabelled pictures.

Edge cases it handles

8
  • Autoplay that keeps moving while someone is reading or interacting is hostile. Pause on hover, on keyboard focus, and when a reduced-motion preference is set, and do not resume automatically after a manual interaction.
  • Keyboard navigation and swiping must drive the same index and the same state. If arrow keys move a separate pointer from the touch gesture, the dots and the visible slide will disagree.
  • A carousel of one image should not show arrows or dots at all. Detect the single-slide case and render a plain image, and handle the zero-slide case with the app's empty state rather than an empty frame.
  • Wrapping from the last slide back to the first must not yank the page scroll position or animate through every slide in between. Move directly and keep the surrounding page still.
  • Loading every slide on first paint wastes bandwidth on images most people never see. Defer offscreen slides but preload the immediate next one so paging forward is not a blank frame.
  • Images that fail to load must leave the slide sized and labelled rather than collapsing the carousel height, and the alt text must still be available.
  • Slides of differing aspect ratios will make the carousel resize on every page. Fix the frame and fit images inside it consistently.
  • A horizontal swipe must not swallow vertical page scrolling. Only capture the gesture once horizontal intent is clear.

Definition of done

9
  • Slides are sized before images load and the page does not shift.
  • Arrows, dots, keyboard, and swipe all move the same index consistently.
  • Autoplay pauses on hover, focus, and hidden tabs, and is disabled under reduced motion.
  • A single-slide carousel hides its arrows and dots.
  • Offscreen slides are deferred while the next slide is preloaded.
  • Every image has alt text and the current position is announced accessibly.
  • Tapping a slide opens the app's existing lightbox rather than a second viewer.
  • The feature matches the existing design system.
  • No existing functionality is broken.

Related features

How it works

  1. 1

    Copy the link

    Grab the Markdown instruction URL for this feature.

  2. 2

    Give it to your AI

    Paste it into Claude Code, Cursor, v0, Lovable — whatever you build with.

  3. 3

    It inspects, then implements

    Your agent reads your existing app first, then adds the feature to fit it.

Works with your stack

These instructions are written to adapt. They tell the agent to detect your framework, match your existing design system, and reuse what you already have — rather than assuming a particular stack.

Need it tighter than that? Customize the feature and tell it exactly what you're running.