Showcase
A slideshow that advances by itself and shows it: a segmented progress bar — the current segment fills over the interval, each one a button — with a counter, previous / next and a visible pause button. It waits for the pointer, the keyboard focus, a hidden tab and a scroll away, and never advances under reduced motion.
Web et mobile — le même composant pour React et React Native. Bêta : son API peut encore changer à une version mineure.
Pourquoi il est là. Orazaka's "Prompt → image" gallery on dev.orazaka.com (KZ-AUTOPLAY), and the demo galleries of the products.
Quand l’utiliser
- A gallery of results that should move on its own — prompt and image, before and after, three steps of a product — where each slide is a small composition (a picture, words, an action).
- A landing page's proof: the reader sees it moving, can stop it and can jump to any slide.
Quand ne pas l’utiliser
- For content the reader must compare or read in order: lay the items out.
- For a band of logos or short quotes that slides continuously.À la place : Marquee
- For cards to swipe away and decide on.À la place : Swipe deck
Installation
Installer
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Importer
import { Showcase, useTypedText, showcaseLabels } from "@krizaka/ui/showcase";Exemples
Prompt → image
An image on the left, its prompt typed on the right with the action: moves on every 6 s, the bar shows how long is left.

A woman on a rooftop at golden hour, soft rim light, 85mm.
Golden-hour editorialSlide 1 of 3
Any content
Text slides, 4 s each, the slide transition, no loop: the last slide stays.
Write what you want in a sentence.
Describe itSlide 1 of 3
Props
An auto-advancing slideshow with a visible, clickable progress bar, a counter, prev / next and a pause button.
| Prop | Type | Défaut | Description |
|---|---|---|---|
getIdrequis | (item: T) => string | — | A stable key for an item. |
itemsrequis | readonly T[] | — | The slides, in order. |
labelrequis | string | — | The slideshow's accessible name (“Prompt to image”), passed translated. |
renderItemrequis | (item: T, state: ShowcaseSlideState) => ReactNode | — | One slide's content. Only the slide in view and its neighbours are mounted (the rest stay empty): give slides the same size. |
autoplay | boolean | true | Advances by itself. Never under prefers-reduced-motion. |
defaultIndex | number | 0 | The slide shown first. |
getTitle | ((item: T) => string) | — | A slide's title, shown before the counter (“Golden-hour editorial”). |
index | number | — | The slide in view (controlled). |
interval | number | 6000 | Milliseconds a slide stays (the time the segment takes to fill). |
labels | ShowcaseLabels | {
previous: "Previous slide",
next: "Next slide",
pause: "Pause the slideshow",
play: "Play the slideshow",
goTo: (n) => `Go to slide ${n}`,
counter: (n, total) => `Slide ${n} of ${total}`,
slide: (n, total) => `${n} of ${total}`,
} | The words of the controls, translated. |
loop | boolean | true | After the last slide, go back to the first. |
onIndexChange | ((index: number, user: boolean) => void) | — | Called when the slide in view changes — user is true when the visitor asked for it. |
transition | "fade" | "slide" | fade | fade crossfades; slide also moves the slides a few pixels. |
Accessibilité
- A region with
aria-roledescription="carousel"named bylabel; each slide is agroup(aria-roledescription="slide") named “n of N”; the slides out of view are hidden and inert. - WCAG 2.2.2: a visible pause button; the show also stops while the pointer is over it, while a keyboard focus is inside, while the tab is hidden and while it is off screen.
- The live region is
politeonly after the visitor navigates — the automatic changes are never announced. - Under
prefers-reduced-motionthe show never advances by itself: no pause button, the current segment is drawn full, the navigation is manual. - On a phone: swipe the pages; Reduce Motion turns the autoplay off; the app in the background holds it.
Clavier
| Touches | Action |
|---|---|
| ← / → | Previous or next slide (the show then reads the new slide aloud). |
| Home / End | First or last slide. |
| Tab | The current segment, previous, pause / play, next, then the content of the slide in view. |
| Enter / Space | On a segment: that slide. On the pause button: stops or restarts the show. |
Bonnes pratiques
- Give every slide the same size (an aspect ratio): only the slide in view and its neighbours are mounted, and the height must not jump.
- Pass
labelstranslated — the controls, the counter (“Image 1 of 17”) and each slide's “n of N”;getTitlenames the slide in the counter. - 5–8 seconds per slide for a picture and a sentence; the bar shows the time, so the reader can decide to stay.
- Type a text with
useTypedTextonly when it is short, and keep the full text for assistive technology (sr-only). - The bar's fill is a CSS animation and its end moves the show: its rules ship with the component, nothing to import.
Composants liés
Générée depuis le code de @krizaka/ui 3.11.0 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub

