Focus Carousel
An infinite, horizontally centred media gallery where one sharp card holds focus while neighbours shrink, desaturate, and blur as a continuous function of distance. Click, drag, or use the keyboard to move the strip; an Image/Video toggle swaps the media in place.
Installation#
pnpm dlx shadcn@latest add @davinciui/focus-carouselUsage#
API Reference#
| Prop | Type | Default |
|---|---|---|
itemsCards in loop order. Each item has id, title, optional subtitle, image { src, alt }, and optional video { src, poster }. Minimum three items is recommended. | FocusCarouselItem[] | — |
defaultIndexCard that starts in the centre in uncontrolled mode. | number | 0 |
indexControlled active index. When it changes the deck animates to the shortest wrapped path. | number | — |
onIndexChangeFires when navigation selects a new active card. | (index: number) => void | — |
mediaModeControlled media toggle value. | "image" | "video" | — |
defaultMediaModeInitial media toggle value in uncontrolled mode. | "image" | "video" | "image" |
onMediaModeChangeFires when the Image/Video toggle changes. | (mode: "image" | "video") => void | — |
showToggleShow the segmented Image/Video control. | boolean | true |
showCaptionShow the triangle indicator, title, and subtitle. | boolean | true |
activeWidthWidth of the centred card in CSS pixels. Height follows aspectRatio. | number | 400 |
sideWidthWidth of cards at distance ≥ 1. The default is 0.52 × activeWidth. | number | 208 |
aspectRatioWidth ÷ height for every card. | number | 3 / 4 |
gapEdge-to-edge gap between cards, kept constant mid-motion. | number | 22 |
maxBlurUpper bound for the distance-driven blur radius. | number | 9 |
durationNavigation travel duration in seconds. | number | 0.55 |
draggableEnable pointer dragging with velocity-aware snapping. Clicks under a 4px movement threshold still navigate. | boolean | true |
responsiveScale the deck down proportionally in containers narrower than 700px. Disable when embedding at a fixed miniature size. | boolean | true |
aria-labelAccessible name for the carousel region. | string | "Focus carousel" |
classNameAdditional CSS classes for the root element. | string | — |
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

