Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Ken Burns Slideshow Gallery Block for React

A framed viewer that runs rail to rail with five drawn stills, each panning and zooming slowly for seven seconds before crossfading to the next, with a caption, segments that fill with the time, Previous, Next and a visible Pause.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

A slow-pan slideshow for React with Base UI, for Longlens, a documentary studio. A compact header sits over one framed viewer that runs from rail to rail, with + marks on its corners. Five drawn stills (a lake, dunes, a forest, a night shore and a coast) each drift and zoom for seven seconds, a different origin and direction every time, then crossfade into the next. A ruled band under the viewer carries the caption (title, place, year and "2 of 5"), five segments that fill as the seven seconds run, Previous and Next buttons and a visible Pause button. Hovering the picture holds the slideshow. Under reduced motion nothing pans, nothing advances and the Pause button goes away, so the stills change only by Previous, Next or a segment. The pictures are drawn, not photographed: a small kit of scenes in your theme's own greys, each a few lines of data you swap for your photographs. It's built from Button and Guides, with CSS animation (the timer is the segment's own animation) and your theme's tokens for every colour. The studio, places and titles are made up for the example.

FAQ

What advances the slideshow?

The filling segment. It is a CSS animation seven seconds long, and when it ends the block shows the next still. Pausing, hovering and reduced motion all stop that one animation, so the picture's pan, the fill and the timer can never fall out of step. Nothing uses setInterval or a frame loop.

How can a visitor stop it?

A Pause slideshow button sits beside Previous and Next, with aria-pressed and a play icon while paused. Hovering the picture also holds it. Under reduced motion nothing moves by itself, so the button is not shown at all and the stills change only when the visitor asks.

Is every change announced to a screen reader?

No, on purpose. When the slideshow turns by itself it is silent, so it never talks over the page. When a visitor presses Previous, Next or a segment, a polite status line says "The last ferry out, 5 of 5". Only the shown still is available to assistive technology, the others are inert, and each is an image named by its description.

How do I change a still's pan?

Each still has a pan string with three custom properties: where the zoom is anchored (origin-[30%_60%]), how far it starts zoomed in (--tw-enter-scale) and the drift it settles from (--tw-enter-translate-x and -y). The pan is slow, twelve seconds against the seven a still is shown, so it never stops short during the crossfade and the drift stays gentle. Keep the zoom under about 1.15 so the picture always covers its frame.

How do I use my own photographs?

Each still in STILLS has a title, a place, a year and a description; add your image's address to it. Then replace the Scene in the viewer with <img alt="" className="size-full object-cover" src={…} />: the picture's label and the caption already name it. The comment above Scene says where.

Does it work right to left?

Yes. The fill grows from the start side of its segment, Previous and Next mirror, and the caption keeps its place and year in reading order. The drawn pictures are never mirrored, because a picture is not text.

  • Pro

    Carousel Gallery

    Carousels and slides

    Nine drawn trail pictures in a ruled band for a trail-guide app, three wide with the next one cut off at the rail, turned with buttons, dots and the arrow keys, under a heading row with a live counter.

  • Pro

    Full-Width Slider Gallery

    Carousels and slides

    Five architecture projects as 21:9 slides from rail to rail with a masked caption, a numbered thumbnail rail as the navigation, loop and autoplay with a visible Pause that never runs under reduced motion.

  • Pro

    Two rows of drawn prints moving in opposite directions under a centred header, landscapes in one and tall portrait prints in the other, with faded ends, titles that link, a visible Pause and hand scrolling under reduced motion.

  • Pro

    Panorama Viewer Gallery

    Compare, crop and zoom

    A drawn alpine valley seven times wider than tall in a framed scroll region you can drag or scroll with the arrow keys, with a minimap that follows the view, a zoom slider from 100% to 300% and a Reset button.

  • Pro

    A split hero for a site speed tool: a headline, a Shine Button and a second action beside a speed report that fills its cell edge to edge, before on one side of a handle and after on the other.

  • Pro

    Phone Frame Carousel Gallery

    Carousels and slides

    Five app screens drawn in phone frames in a ruled band, the chosen one centred at full strength with its neighbours peeking in veiled, steered by a row of five feature tabs under a compact header.