Marquee
Continuously scrolls content in a loop, horizontally or vertically, with optional pause on hover and fade edges.
Component
Props
| Props | Default | Type |
|---|---|---|
orientation | Orientation.HORIZONTAL | Orientation |
speed | 50 | number |
gap | '1rem' | string |
isReversed | false | boolean |
autoFill | true | boolean |
pauseOnHover | false | boolean |
isPaused | false | boolean |
hasFadeEdges | false | boolean |
fadeSize | 10 | number |
delay | 0 | number |
loopCount | 0 | number |
ariaLabel | — | string |
Slots
| Name | Description |
|---|---|
default | Items to scroll. The slot is repeated to build a seamless loop. |
<template>
<Marquee ariaLabel="Partners">
<span>Item 1</span>
<span>Item 2</span>
<span>Item 3</span>
</Marquee>
</template>
Usage
orientation
Sets the scroll axis via the Orientation enum. Vertical marquees need a parent with a fixed height.
<template>
<div class="h-64">
<Marquee :orientation="Orientation.VERTICAL" />
</div>
</template>
Options
| Value | Description |
|---|---|
HORIZONTAL | Scrolls from right to left. |
VERTICAL | Scrolls from bottom to top. |
speed
Sets the scroll speed in pixels per second.
<template>
<Marquee :speed="100" />
</template>
gap
Sets the space between items using any CSS length.
<template>
<Marquee gap="2rem" />
</template>
isReversed
Reverses the scroll direction.
<template>
<Marquee isReversed />
</template>
autoFill
Repeats the content as many times as needed to fill the container. Set it to false to loop the content only once.
<template>
<Marquee :autoFill="false" />
</template>
pauseOnHover
Pauses the animation while the pointer is over the marquee or focus is inside it.
<template>
<Marquee pauseOnHover />
</template>
isPaused
Pauses the animation from outside, for example with a play/pause button.
<template>
<Marquee :isPaused="isPaused" />
</template>
<script setup lang="ts">
const isPaused = ref(false)
</script>
hasFadeEdges
Fades the content out at both ends of the marquee.
<template>
<Marquee hasFadeEdges />
</template>
fadeSize
Sets how much of the container fades at each end, as a percentage from 0 to 50. Only applies when hasFadeEdges is enabled.
<template>
<Marquee hasFadeEdges :fadeSize="20" />
</template>
delay
Sets the delay before the animation starts, in seconds.
<template>
<Marquee :delay="2" />
</template>
loopCount
Sets how many times the content loops. 0 loops forever.
<template>
<Marquee :loopCount="3" />
</template>
ariaLabel
Sets the accessible name of the marquee group.
<template>
<Marquee ariaLabel="Our partners" />
</template>
Accessibility
Emits
| Value | Description |
|---|---|
@loopComplete | Triggers after each loop iteration. |
@complete | Triggers when all loops finish. Only fires when `loopCount` is greater than 0. |
Example
<template>
<Marquee :loopCount="2" @complete="handleComplete" />
</template>
<script setup lang="ts">
const handleComplete = () => {
console.log("Marquee finished")
}
</script>