Deck
Deck composes stacked cards with index and swipe callbacks.
Practical React example
Let someone browse a small collection of cards with a swipe interaction and visible alternatives.
Before you copy and paste
Use the composed primitives together under their required provider, where one is present. Copy components/kibo-ui/deck/index.tsx and its returned support files from the Code tab; preserve the project-relative paths.
Listed package dependencies: @radix-ui/react-use-controllable-state, lucide-react, motion.
Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.
Let someone browse a small collection of cards with a swipe interaction and visible alternatives
// Usage adapted from Kibo UI's pinned MIT source.
// Copyright (c) 2023 — Present shadcnblocks. See ./LICENSES.md.
"use client";
import { Deck, DeckCards, DeckEmpty, DeckItem } from "@/components/kibo-ui/deck";
import Image from "next/image";
const images = [
{
id: 1,
src: "https://placehold.co/400x600/ff6b6b/fff?text=Card+1",
title: "Card 1",
},
{
id: 2,
src: "https://placehold.co/400x600/4ecdc4/fff?text=Card+2",
title: "Card 2",
},
{
id: 3,
src: "https://placehold.co/400x600/45b7d1/fff?text=Card+3",
title: "Card 3",
},
{
id: 4,
src: "https://placehold.co/400x600/96ceb4/fff?text=Card+4",
title: "Card 4",
},
{
id: 5,
src: "https://placehold.co/400x600/feca57/fff?text=Card+5",
title: "Card 5",
},
];
const Example = () => (
<Deck className="size-full">
<DeckCards>
{images.map((image) => (
<DeckItem className="p-0" key={image.id}>
<Image
alt={image.title}
className="h-full w-full rounded-lg object-cover"
draggable={false}
height={600}
src={image.src}
unoptimized
width={400}
/>
</DeckItem>
))}
</DeckCards>
<DeckEmpty />
</Deck>
);
export default Example;
Usage example adapted from Kibo UI's pinned MIT source. Retain the source licence notices when copying.
Keep the active index aligned with stable item data and distinguish a swipe end from an actual persisted accept or reject decision.
Customization
- DeckCardsProps.onSwipe
- Optional; (index: number, direction: "left" | "right") => void.
- DeckCardsProps.onSwipeEnd
- Optional; (index: number, direction: "left" | "right") => void.
- DeckCardsProps.threshold
- Optional; number.
- DeckCardsProps.stackSize
- Optional; number.
- DeckCardsProps.perspective
- Optional; number.
- DeckCardsProps.scale
- Optional; number.
- DeckCardsProps.currentIndex
- Optional; number.
- DeckCardsProps.defaultCurrentIndex
- Optional; number.
- DeckCardsProps.onCurrentIndexChange
- Optional; (index: number) => void.
- DeckCardsProps.animateOnIndexChange
- Optional; boolean.
- DeckCardsProps.indexChangeDirection
- Optional; "left" | "right".
- DeckCardProps.children
- Required; ReactElement.
- DeckCardProps.onSwipe
- Required; (direction: "left" | "right") => void.
- DeckCardProps.threshold
- Required; number.
Integration notes
- Provide buttons or another keyboard path for navigation through the same collection.
- Do not make a destructive choice irreversible merely because a card moved off screen.
Component source: Kibo UI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.
Give your agent taste.
The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.
All components are free. Sign up only to connect MCP.