On this page

Carousel

Live examples of Carousel, with the exact Vue file that renders each one.

Every example is a complete Vue file. Copy it into an app that has the registry installed, or open it in StackBlitz. Click a carousel, or Tab to it, and use the arrow keys.

One slide at a time

Each slide is named “1 of 3”. The buttons turn grey at either end.

Map your fields
Match each online store field to an ERP field before the first sync.
Tip 1 of 3
Test with one order
Send a single order and check it in the ERP before turning on the schedule.
Tip 2 of 3
Watch the first day
Failed syncs show on the dashboard; most are fixed by a missing mapping.
Tip 3 of 3
CarouselTips.vue
<script setup lang="ts">
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from '@/components/ui/carousel'

const tips = [
  { title: 'Map your fields', text: 'Match each online store field to an ERP field before the first sync.' },
  { title: 'Test with one order', text: 'Send a single order and check it in the ERP before turning on the schedule.' },
  { title: 'Watch the first day', text: 'Failed syncs show on the dashboard; most are fixed by a missing mapping.' },
]
</script>

<template>
  <div class="w-full max-w-100 px-(--bh-space-600)">
    <Carousel aria-label="Getting started tips">
      <CarouselContent>
        <CarouselItem v-for="(tip, index) in tips" :key="tip.title" :aria-label="`${index + 1} of ${tips.length}`">
          <Card size="sm">
            <CardHeader>
              <CardTitle>{{ tip.title }}</CardTitle>
              <CardDescription>{{ tip.text }}</CardDescription>
            </CardHeader>
            <CardContent class="text-(--bh-color-text-subtle) [font:var(--bh-font-body-small)]">Tip {{ index + 1 }} of {{ tips.length }}</CardContent>
          </Card>
        </CarouselItem>
      </CarouselContent>
      <CarouselPrevious />
      <CarouselNext />
    </Carousel>
  </div>
</template>

Several slides in view

Set the item basis, such as basis-1/3, and align: 'start' in opts.

Jasmine tea
Oolong tea
Ceramic cup
Tea pot
Gift box
Tea towel
CarouselProducts.vue
<script setup lang="ts">
import { Package } from '@lucide/vue'
import { AspectRatio } from '@/components/ui/aspect-ratio'
import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from '@/components/ui/carousel'

// Several slides in view: set the item basis. align "start" keeps the first slide at the edge.
const products = ['Jasmine tea', 'Oolong tea', 'Ceramic cup', 'Tea pot', 'Gift box', 'Tea towel']
</script>

<template>
  <div class="w-full max-w-120 px-(--bh-space-600)">
    <Carousel :opts="{ align: 'start' }" aria-label="Best-selling products">
      <CarouselContent>
        <CarouselItem
          v-for="(product, index) in products"
          :key="product"
          :aria-label="`${index + 1} of ${products.length}`"
          class="basis-1/2 sm:basis-1/3"
        >
          <AspectRatio :ratio="1">
            <div class="flex size-full flex-col items-center justify-center gap-(--bh-space-100) rounded-(--bh-radius-card) border-(length:--bh-border-width-default) border-(--bh-color-border) bg-(--bh-color-surface) p-(--bh-space-100) text-center">
              <Package aria-hidden="true" class="size-(--bh-size-icon-large) text-(--bh-color-icon-subtle)" />
              <span class="text-(--bh-color-text) [font:var(--bh-font-label-default)]">{{ product }}</span>
            </div>
          </AspectRatio>
        </CarouselItem>
      </CarouselContent>
      <CarouselPrevious />
      <CarouselNext />
    </Carousel>
  </div>
</template>