marquee
nuxt-marquee

A lightweight Nuxt 3 module that harnesses the power of CSS animations to create silky smooth marquees.

Nuxt Marquee

A lightweight Nuxt module that harnesses the power of CSS animations to create silky smooth marquees. Powered by vue-fast-marquee.

๐ŸŽฎ Interactive Playground / Demo

๐Ÿ“Œ Upgrading to v2.x: Vertical marquees now use native CSS column layouts (no manual width/height swapping needed). This release also adds interactive drag scrubbing (draggable), programmatic playback methods (play, pause, reset, etc.), and dark mode gradient support (gradientColorDark).

๐Ÿš€ What's New in v2.x

  • ๐Ÿ–ฑ๏ธ Drag-to-Scrub: Set draggable to allow users to drag or swipe to scrub through marquee content.
  • ๐ŸŽฎ Imperative Controls: Access component playback methods (play(), pause(), toggle(), reset()) and state via template refs.
  • ๐ŸŒ™ Dark Mode Gradient: Added gradientColorDark for dark mode gradient masks (activates when .dark class is present).
  • ๐Ÿ“ Native Vertical Marquee: Vertical directions (up / down) now render natively with CSS flex column layout and vertical gradients.
  • โšก Smooth Playback: Improved hover and click pause handling to work seamlessly alongside drag scrubbing.

Installation

npx nuxi@latest module add marquee

Example

<template>
    <NuxtMarquee>
        <MyComponent />
        <MyComponent />
        <MyComponent />
    </NuxtMarquee>
</template>

Props

PropertyTypeDefaultDescription
autoFillbooleanfalseWhether to automatically fill blank space in the marquee with copies of the children or not
playbooleantrueWhether to play or pause the marquee
pauseOnHoverbooleanfalseWhether to pause the marquee when hovered
pauseOnClickbooleanfalseWhether to pause the marquee when clicked
direction"left" | "right" | "up" | "down""left"The direction the marquee is sliding
speednumber50Speed calculated as pixels/second
delaynumber0Duration to delay the animation after render, in seconds
loopnumber0The number of times the marquee should loop, 0 is equivalent to infinite
gradientbooleanfalseWhether to show the gradient mask on the edges or not
gradientColorstring"white"The color of the gradient mask
gradientColorDarkstringgradientColorThe color of the gradient mask in dark mode (activates when .dark class is present). Defaults to gradientColor if not set
gradientWidthnumber | string200The width/height of the gradient on either side (in pixels or CSS unit string)
draggablebooleanfalseEnable manual dragging/swiping with pointer/touch to scrub through the marquee

Events

Event NameDescription
finishEmitted when the marquee finishes scrolling and stops. Only calls if loop is non-zero.
cycleCompleteEmitted when the marquee finishes a loop. Does not call if maximum loops are reached (use onFinish instead).

Component Methods

Access methods programmatically using a Vue template ref:

<script setup lang="ts">
import { NuxtMarquee } from '#components';

const marqueeRef = ref<InstanceType<typeof NuxtMarquee>>();
</script>

<template>
    <NuxtMarquee ref="marqueeRef">...</NuxtMarquee>
    <button @click="marqueeRef?.pause()">Pause</button>
    <button @click="marqueeRef?.reset()">Reset</button>
</template>
Method / PropertyTypeDescription
play()() => voidStarts or resumes the animation
pause()() => voidPauses the animation
toggle()() => voidToggles between play and pause
reset()() => voidResets animation time to 0 and starts playing
isPlayingComputedRef<boolean>Whether the animation is currently playing
isPausedComputedRef<boolean>Whether the animation is currently paused

License

MIT - Made with ๐Ÿ’™ by Hร nzy