carousel

Carousel

Scrolls slides sideways or up and down, with previous and next buttons, dots that jump to a slide and a bar that shows how far the shopper has scrolled.

Parts

PartFileDoes
CarouselCarousel.vueGroups all parts of the carousel, which scrolls through items sideways.
CarouselContentCarouselContent.vueHolds the slides of the carousel in a scrollable row.
CarouselDotsCarouselDots.vueShows one dot per slide and lets the user jump to a slide.
CarouselItemCarouselItem.vueHolds the content of one slide in the carousel.
CarouselNextCarouselNext.vueLets the user scroll the carousel to the next slide.
CarouselPreviousCarouselPrevious.vueLets the user scroll the carousel to the previous slide.
CarouselProgressCarouselProgress.vueShows how far the user has scrolled through the carousel.

Anatomy

<Carousel>
  <CarouselContent>
    <CarouselItem />
  </CarouselContent>
  <CarouselPrevious />
  <CarouselNext />
  <CarouselDots />
  <CarouselProgress />
</Carousel>

Styling

All of Carousel’s styles live in carousel.json. New to styling in Frontic UI? How styling works →

Install

Installs with it
button
npm packages
@lucide/vue
@vueuse/core
class-variance-authority
embla-carousel-vue@9.0.0-rc04
reka-ui

Built from

API reference

CarouselContent.vue

CarouselDots.vue

CarouselItem.vue

CarouselNext.vue

CarouselPrevious.vue

CarouselProgress.vue
Carousel

Multi slide

1<!-- SPDX-License-Identifier: FSL-1.1-MIT AND MIT -->2<!-- Frontic UI © Frontic · Portions © 2023 unovue (shadcn-vue, MIT) · ui.frontic.com/license -->3<script setup lang="ts">4import { Image } from '@/components/ui/image'5import {6  Carousel,7  CarouselContent,8  CarouselItem,9  CarouselNext,10  CarouselPrevious,11} from '@/components/ui/carousel'12 13const image = (name: string) =>14  `https://static.frontic.com/cdn-cgi/image/width=480,format=auto/ui/products/${name}.jpg`15 16// Three slides at a time: each item takes a third of the viewport.17const jackets = [18  { name: 'Blizzard Defender', image: 'blizzard-defender-aubergine' },19  { name: 'Glacier Explorer', image: 'glacier-explorer' },20  { name: 'Arctic Fox Winter Jacket', image: 'arctic-fox-winter-jacket' },21  { name: 'Frost Escape Parka', image: 'frost-escape-parka' },22]23</script>24 25<template>26  <div class="mx-auto w-full max-w-2xl px-12">27    <Carousel :opts="{ align: 'start' }" class="w-full">28      <CarouselContent>29        <CarouselItem30          v-for="jacket in jackets"31          :key="jacket.name"32          class="basis-1/3">33          <figure class="flex flex-col gap-2">34            <Image35              :src="image(jacket.image)"36              :alt="jacket.name"37              class="aspect-square w-full" />38            <figcaption>{{ jacket.name }}</figcaption>39          </figure>40        </CarouselItem>41      </CarouselContent>42      <CarouselPrevious />43      <CarouselNext />44    </Carousel>45  </div>46</template>
State