Skip to content

Components

HeroSlider

The main slider component. Wraps Swiper and manages backgrounds, overlays, animations, video, and parallax.

Props

PropTypeDefaultDescription
slidesHeroSlide[]requiredArray of slide objects
sliderUseHeroSliderReturnrequiredReturn value of useHeroSlider()
enterAnimationstring''Default enter animation class
leaveAnimationstring''Default leave animation class
overlayPatternsOverlayPattern[][{ type: 'lines', opacity: 0.1 }]Stacked overlay patterns
parallaxboolean | ParallaxConfigtrueParallax config — false to disable, true for defaults, or object
imagePresetstring''@nuxt/image preset name for backgrounds
asstring'div'Wrapper element tag
uiHeroSliderUI{}Class overrides for internal elements

Slots

#slide

Main content slot for each slide.

vue
<template #slide="{ slide, index, isActive, animationClass, isVideo,
  videoPlaying, videoDuration, videoCurrentTime, videoWaiting, videoEnded,
  videoMuted, videoVolume, videoToggle, videoSeek, videoSetVolume, videoToggleMute }">
  <div class="flex size-full items-center justify-center">
    <h1>{{ slide.title }}</h1>
  </div>
</template>
PropTypeDescription
slideHeroSlideCurrent slide data
indexnumberSlide index
isActivebooleanWhether this slide is active
animationClassstringResolved CSS animation class
isVideobooleanWhether the slide has a video background
videoPlayingbooleanVideo playback state
videoDurationnumberVideo duration in seconds
videoCurrentTimenumberCurrent playback position
videoWaitingbooleanVideo is buffering
videoEndedbooleanVideo has ended
videoMutedbooleanVideo mute state
videoVolumenumberVideo volume (0–1)
videoToggle() => voidPlay/pause toggle
videoSeek(time: number) => voidSeek to time
videoSetVolume(v: number) => voidSet volume
videoToggleMute() => voidToggle mute

#pagination

Replace the default pagination dots.

vue
<template #pagination="{ activeIndex, snapIndex, totalSnaps, total,
  progress, goTo, vertical, autoplayEnabled }">
  <div class="flex gap-2">
    <button v-for="i in total" :key="i" @click="goTo(i - 1)">
      {{ i }}
    </button>
  </div>
</template>

Replace the default prev/next arrows.

vue
<template #navigation="{ prev, next, activeIndex, slides, vertical }">
  <button @click="prev">Previous</button>
  <button @click="next">Next</button>
</template>

#overlay

Custom overlay rendering per slide.

vue
<template #overlay="{ patterns, index, isActive, patternCSS, patternSize }">
  <div v-for="(p, i) in patterns" :key="i"
    :style="{ backgroundImage: patternCSS(p), backgroundSize: patternSize(p), opacity: p.opacity }"
    class="absolute inset-0" />
</template>

#video-controls

Replace the built-in video controls.

vue
<template #video-controls="{ playing, currentTime, duration, buffered,
  volume, muted, waiting, hls }">
  <div class="absolute bottom-4 left-4">
    <span>{{ formatTime(currentTime) }} / {{ formatTime(duration) }}</span>
  </div>
</template>

HeroSlide

Internal slide component. Renders background image/video, overlay patterns, and content via the #slide slot. Automatically registered — not typically used directly.

HeroNavigation

Navigation arrows. Adapts orientation for direction: 'vertical' — arrows move to top/bottom. Automatically rendered when showNavigation: true.

HeroPagination

Pagination dots with tooltip thumbnails. Adapts position for vertical layouts (moves to the side). Automatically rendered when showPagination: true.

HeroSlideVideo

Video background component. Supports MP4, WebM, and HLS (.m3u8). Integrates with VueUse's useMediaControls for reactive playback state.

HeroVideoControls

Built-in video controls overlay with play/pause, volume, mute, and fullscreen. Automatically rendered when showVideoControls: true.

HeroVideoScrubber

Video timeline scrubber with buffered progress visualization. Rendered as part of the progress bar when the active slide is a video.

UI Customization

Override internal element classes with the ui prop:

vue
<HeroSlider
  :ui="{
    root: 'my-hero-root',
    swiper: 'rounded-xl overflow-hidden',
    slide: 'bg-gray-900',
    container: 'p-8',
    bg: 'brightness-75',
    controls: 'z-50',
    progress: 'bg-blue-500',
  }"
/>
KeyTargetDescription
rootRoot wrapperOutermost element
swiperSwiper containerThe <Swiper> wrapper
slideSwiperSlideEach slide wrapper
container.hero-slideSlide inner container
bg.hero-slide-bgBackground image/video layer
controlsControls overlayPagination, navigation, progress
progressProgress bar trackAutoplay/video progress

Released under the MIT License.