Cover Flow
A shelf of covers in 3D: drag, flick or scroll it and it settles on the one in front.
- Category
- Creative
- Access
- Free with an account
- Source
- 213 lines · one file
- States
- 4 drawn
- Added
- 3 Nov 2026
The decision inside it
Only the covers near the front are drawn
Five either side by default, so a shelf of five hundred costs the same as ten. A flick coasts and always settles on a cover. It's a listbox for keyboards and screen readers, and with reduced motion it becomes a flat sliding row.
When to use it
Use Cover Flow to browse visual items one at a time: templates, albums, books, product shots. For a plain row of slides use Carousel.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Liro's Cover Flow for this.
Install it: npx shadcn@latest add @liro/cover-flow
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/cover-flow.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Free components install through the @liro registry with your CLI token: see the Namespaced tab.
Usage
"use client";
import { CoverFlow } from "@/components/ui/cover-flow";
type Template = { id: string; title: string; image: string };
export function TemplateShelf({ templates, onOpen }: { templates: Template[]; onOpen: (t: Template) => void }) {
return (
<CoverFlow
aria-label="Templates"
items={templates}
getKey={(t) => t.id}
getLabel={(t) => t.title}
renderCover={(t) => <img src={t.image} alt="" className="size-full object-cover" />}
onSelect={onOpen}
/>
);
}API reference
“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Type | Notes | ||
|---|---|---|---|
items | T[] | Yes | – |
getKey | (item: T) => string | Yes | – |
getLabel | (item: T) => string | Yes | – |
renderCover | (item: T, state: { active: boolean }) => React.ReactNode | Yes | – |
onSelect | (item: T, index: number) => void | No | Pressing the cover in front, or Enter. |
onActiveChange | (index: number) => void | No | Called as the front cover changes. |
defaultIndex | number | No | – |
size | number | No | Cover size in pixels. Default 220. |
range | number | No | Covers drawn on each side. Default 5. |
reflection | boolean | No | Show the reflection. Default true. |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLiro foundations, installed alongside it
liro-themeStates
All of them are drawn by the component. None is left for you to design.
- Settled
- Dragging
- Few covers
- Empty
Accessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances