Components

Card Carousel

Swipe through cards, then open one into a full page.

Install with one command, or copy the files

Preview

Swipe the cards, or let them play. Tap one to open it, then tap back, press Escape, or drag it down.

Install

pnpx sothearo add card-carousel

It checks whether you use Vue, Nuxt or React, and adds only the files you need to your components folder, in card-carousel/. They're yours to change.

Usage

Give it items with an id and a color, then draw each card and its page. The page opens inside the carousel, so give the carousel the size you want the page to fill.

Projects.vue
<script setup lang="ts">
import CardCarousel from "@/components/card-carousel/CardCarousel.vue";

const projects = [
  { id: "aksar", color: "#ffd84d", name: "Aksar" },
  { id: "mitai", color: "#f07890", name: "Mitai" },
];
</script>

<template>
  <CardCarousel :items="projects" :autoplay="4000" class="h-[560px]">
    <template #card="{ item }">
      <h3>{{ item.name }}</h3>
    </template>
    <template #detail="{ item, close }">
      <button @click="close">
        Back
      </button>
      <h2>{{ item.name }}</h2>
    </template>
  </CardCarousel>
</template>

How it moves

  • Swiping uses the browser's own scrolling, so momentum, trackpads and touch feel native.
  • Cards beside the centre shrink and fade a little, following your finger.
  • The background blends from one card's colour to the next.
  • Opening grows the card into the page, then the content fades in.
  • Autoplay pauses while you hover, touch, focus or read a page, and stops for reduced motion.

Props

PropTypeDefaultWhat it does
itemsItem[]Cards to show. Each needs an id, and can have a color.
orientation"horizontal" | "vertical""horizontal"Swipe sideways, or up and down like stories.
autoplaynumberMilliseconds per card. Leave it out to stay still.
labelstring"Cards"Name for screen readers.
v-model:openstringThe id of the open card.

Drawing cards

SlotGives youWhat it draws
#carditem, index, activeEach card.
#detailitem, closeThe page a card opens into.

Customise

carousel.css
[data-card-carousel] {
  --carousel-card-size: 70%;
  --carousel-radius: 32px;
  --carousel-gap: 12px;
}

Accessibility

  • Cards are buttons, and the dots jump to a card.
  • The open page is a dialog that closes with Escape.
  • Motion and autoplay stop when the system asks for reduced motion.
Code by day, manga by night.2026