Skip to main content
  • Foundation
  • Color palette
  • Typography
  • Icons
  • Golden ratio
  • Grid system
  • Shadows & glow
  • Motion
  • Theme
  • Theme switcher
  • Color rosette
  • Theme customizer
  • Core
  • Button
  • Badge
  • Alert
  • Card
  • Dropdown
  • Menu
  • Popover
  • Doc Search
  • Global Search
  • Floating Action Button
  • Ripple
  • Expanding Cards
  • Spotlight
  • Timeline
  • Template
  • Navigation
  • Feedback
  • Modal
  • Toast
  • Tooltip
  • Chip
  • Skeleton
  • Preloader
  • Data display
  • Avatar
  • Table
  • Collection
  • Breadcrumb
  • Interactive
  • Tabs
  • Accordion
  • Flow
  • Draggable
  • Search
  • Canvas
  • Charts
  • Flowchart
  • Media
  • Image Box
  • Effects
  • Glass
  • Surfaces
  • Morph
  • Parallax
  • Liquid Gradient
  • Forms
  • Form controls
  • Login
  • Form validation
  • Datepicker
  • Timepicker
  • Rating
  • Switch
  • Slider
  • Stepper
  • Autocomplete
  • Transfer
  • Tree
  • Pagination
  • Button group
  • Primitives
  • Progress
  • Spinner
  • Code snippet
  • Layout
  • Primitives
  • Separator
  • Sidenav
  • Sticky
  • Waypoint (Scrollspy)
  • Off-canvas
  • Navbar
  • Oola Dock
  • Footer
Flow / Carousel

A carousel for stepping through a sequence of slides, with previous and next controls and optional looping.

VdFlow Component

First Slide

Controlled via v-model (slide 1 of 3)

Second Slide

Rendered in named slot #slide-1

Third Slide

Exposes { go, prev, next, index } on template ref

1 / 3

v-model is the slide index. Slots are #slide-0 through #slide-n. The exposed controller is go, prev, next, and index.

<script setup lang="ts">
import { ref } from 'vue';
import { VdFlow } from '@vanduo-oss/vd3';

const slide = ref(0);
</script>

<template>
  <VdFlow v-model="slide" :total="3">
    <template #slide-0>First slide</template>
    <template #slide-1>Second slide</template>
    <template #slide-2>Third slide</template>
  </VdFlow>
</template>
Basic Carousel

Slide One

Horizontal slide transition

Slide Two

Swipe or use controls to navigate

Slide Three

Fully responsive and accessible

<div class="vd-flow" data-vd-loop="true">
  <div class="vd-flow-track">
    <div class="vd-flow-slide">Slide One</div>
    <div class="vd-flow-slide">Slide Two</div>
    <div class="vd-flow-slide">Slide Three</div>
  </div>
  <button class="vd-flow-prev" aria-label="Previous slide">&lsaquo;</button>
  <button class="vd-flow-next" aria-label="Next slide">&rsaquo;</button>
</div>
Fade Variant

Cross-fade transition

Smooth opacity blend

Elegant transitions

<!-- Add .vd-flow-fade for crossfade -->
<div class="vd-flow vd-flow-fade">
  <div class="vd-flow-track">
    <div class="vd-flow-slide">...</div>
    <div class="vd-flow-slide">...</div>
  </div>
  <button class="vd-flow-prev">&lsaquo;</button>
  <button class="vd-flow-next">&rsaquo;</button>
</div>
Autoplay with Indicators

Auto-advances every 4s

Pauses on hover

Click indicator to jump

<!-- Autoplay with indicators -->
<div class="vd-flow"
     data-vd-autoplay="true"
     data-vd-interval="4000"
     data-vd-loop="true">
  <div class="vd-flow-track">
    <div class="vd-flow-slide">...</div>
    <div class="vd-flow-slide">...</div>
  </div>
  <button class="vd-flow-prev">...</button>
  <button class="vd-flow-next">...</button>
  <div class="vd-flow-indicators">
    <button aria-label="Go to slide 1"></button>
    <button aria-label="Go to slide 2"></button>
  </div>
</div>
Compact Size

Compact slide A

Compact slide B

Large Size

Hero-size Carousel

Great for feature showcases and landing pages

Full-width Content

Increased padding and height for impact

API Reference

Wiring

import { ref } from 'vue';
import { useFlow } from "@vanduo-oss/vd3";

const root = ref<HTMLElement | null>(null);
const flow = useFlow(root); // wires every .vd-flow inside root; cleanup on unmount

// programmatic control via returned FlowApi:
// flow.next(el), flow.prev(el), flow.goTo(el, 2), flow.refresh()

// react to slide changes
root.value?.addEventListener('flow:change', (e) => {
  console.log('slide', e.detail.current); // { current, previous, total }
});

CSS Classes

ClassDescriptionType
.vd-flowBase carousel container — requiredBase
.vd-carouselAlias for .vd-flowBase
.vd-flow-trackInner wrapper holding all slides; handles translationStructure
.vd-flow-slideIndividual slide element within the trackStructure
.vd-flow-prevPrevious-slide navigation buttonControl
.vd-flow-nextNext-slide navigation buttonControl
.vd-flow-indicatorsContainer for dot indicators; one button per slideControl
.vd-flow-fadeCrossfade transition instead of horizontal slideModifier
.vd-flow-compactReduced padding and height for compact layoutsSize
.vd-flow-lgIncreased padding and height for hero-style carouselsSize

Data Attributes

AttributeDescriptionDefault
data-vd-autoplayEnable automatic slide advancement when set to "true"false
data-vd-intervalTime in milliseconds between auto-advances5000
data-vd-loopLoops back to the first slide after the last; set to "false" to disabletrue

VdFlow Component API

Prop / Slot / ExposedDescription
v-model (modelValue)number — zero-based active slide index.
:totalnumber — total number of slides to render.
#slide-{i}Named scoped slot for slide i (0 to total - 1); receives { index }.
Exposed (template ref){ go(index), prev(), next(), index: Ref<number> } — imperative slide controls.

Composable API (useFlow)

SymbolDescription
useFlow(root)Composable — wires every .vd-flow / .vd-carousel inside the root ref (prev/next, indicators, keyboard, touch swipe, autoplay) and returns a FlowApi controller.
goTo(el, index)FlowApi method — jump the given .vd-flow element to zero-based slide index (wraps when data-vd-loop is enabled, clamps otherwise).
next(el) / prev(el)FlowApi methods — step the given .vd-flow element forward or backward one slide.
refresh()FlowApi method — re-scans root for newly added .vd-flow elements and syncs slide/indicator ARIA.
(automatic cleanup)Listeners, live regions, and autoplay timers are cleared on component unmount.

Events

EventDescriptionDetail
flow:change Fired on the .vd-flow element after a slide transition completes { current, previous, total }
Accessibility
  • Navigation buttons include aria-label attributes for screen readers
  • Indicator buttons use aria-label="Go to slide N" for identification
  • Active indicator receives aria-current="true" and .is-active class
  • Autoplay pauses on :hover and :focus-within to respect user interaction
  • Keyboard navigation: ArrowLeft / ArrowRight move between slides when focused
  • The carousel container uses role="region" and aria-roledescription="carousel"
  • Each slide uses role="group" and aria-roledescription="slide"