Apple Cards Carousel
- Source
- Aceternity UI ↗
- Author
- Aceternity UI
- Licence
- Aceternity UI licence (free component)
Loading…
A horizontal carousel of cards; clicking one expands it into a full panel.
Code
"use client";
import React from "react";
import { Fit } from "./_fit";
import { Carousel, Card } from "@/lab/aceternity/ui/apple-cards-carousel";
export default function AppleCardsCarouselDemo() {
const cards = data.map((card, index) => (
<Card key={card.src} card={card} index={index} />
));
return (
<Fit width={820} height={500}>
<div data-ace-portal className="relative w-full h-full py-6">
<h2 className="max-w-7xl pl-4 mx-auto text-4xl font-bold text-neutral-800 dark:text-neutral-200 font-sans">
Get to know your iSad.
</h2>
<Carousel items={cards} />
</div>
</Fit>
);
}
const DummyContent = () => {
return (
<>
{[...new Array(3).fill(1)].map((_, index) => {
return (
<div
key={"dummy-content" + index}
className="bg-[#F5F5F7] dark:bg-neutral-800 p-8 rounded-3xl mb-4"
>
<p className="text-neutral-600 dark:text-neutral-400 text-base font-sans max-w-3xl mx-auto">
<span className="font-bold text-neutral-700 dark:text-neutral-200">
The first rule of Apple club is that you boast about Apple club.
</span>{" "}
Keep a journal, quickly jot down a grocery list, and take amazing
class notes. Want to convert those notes to text? No problem.
Langotiya jeetu ka mara hua yaar is ready to capture every
thought.
</p>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
src="https://assets.aceternity.com/macbook.png"
alt="Macbook mockup from Aceternity UI"
height="500"
width="500"
className="w-1/2 h-1/2 mx-auto object-contain"
/>
</div>
);
})}
</>
);
};
const data = [
{
category: "Artificial Intelligence",
title: "You can do more with AI.",
src: "https://images.unsplash.com/photo-1593508512255-86ab42a8e620?q=80&w=800&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
content: <DummyContent />,
},
{
category: "Productivity",
title: "Enhance your productivity.",
src: "https://images.unsplash.com/photo-1531554694128-c4c6665f59c2?q=80&w=800&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
content: <DummyContent />,
},
{
category: "Product",
title: "Launching the new Apple Vision Pro.",
src: "https://images.unsplash.com/photo-1713869791518-a770879e60dc?q=80&w=800&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
content: <DummyContent />,
},
{
category: "Product",
title: "Maps for your iPhone 15 Pro Max.",
src: "https://images.unsplash.com/photo-1599202860130-f600f4948364?q=80&w=800&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
content: <DummyContent />,
},
{
category: "iOS",
title: "Photography just got better.",
src: "https://images.unsplash.com/photo-1602081957921-9137a5d6eaee?q=80&w=800&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
content: <DummyContent />,
},
{
category: "Hiring",
title: "Hiring for a Staff Software Engineer",
src: "https://images.unsplash.com/photo-1511984804822-e16ba72f5848?q=80&w=800&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
content: <DummyContent />,
},
];
Prompt
Build "Apple Cards Carousel", a layout animation. What it does: A horizontal carousel of cards; clicking one expands it into a full panel. Write it as a single self-contained React component in TypeScript that fills its parent (w-full h-full), styled with Tailwind CSS, using @tabler/icons-react, motion. Technique: the Motion library. It sits on a light background, in a 16:10 frame. Respect prefers-reduced-motion with a still state, pause work when the element is off screen, and keep it accessible. Original: https://ui.aceternity.com/components/apple-cards-carousel (Aceternity UI, Aceternity UI licence (free component)).