marquee
sv-blocks/marqueeFreeComponent
Animated marquee component for horizontally or vertically scrolling content
Install it
npx shadcn@latest add https://sv-blocks.vercel.app/r/marquee.jsonSource
1<script lang="ts">2 import { cn } from "$UTILS$";3 import type { Snippet } from "svelte";45 type MarqueeProps = {6 pauseOnHover?: boolean;7 vertical?: boolean;8 repeat?: number;9 reverse?: boolean;10 class?: string;11 children?: Snippet;12 };13 let {14 pauseOnHover = false,15 vertical = false,16 repeat = 4,17 reverse = false,18 class: _class = "",19 children,20 }: MarqueeProps = $props();21</script>2223<div24 class={cn(25 "group flex gap-(--gap) overflow-hidden p-2 [--duration:16s] [--gap:3rem]",26 {27 "flex-row": !vertical,28 "flex-col": vertical,29 },30 _class31 )}32>33 {#each { length: repeat } as _, i (i)}34 <div35 class={cn("flex shrink-0 justify-around gap-(--gap)", {36 "animate-marquee flex-row": !vertical,37 "animate-marquee-vertical flex-col": vertical,38 "group-hover:paused": pauseOnHover,39 })}40 style="animation-direction:{reverse ? 'reverse' : 'normal'};41 "42 >43 {@render children?.()}44 </div>45 {/each}46</div>4748<style>49 @keyframes marquee {50 0% {51 transform: translateX(0%);52 }53 100% {54 transform: translateX(-100%);55 }56 }5758 @keyframes marquee-vertical {59 0% {60 transform: translateY(0%);61 }62 100% {63 transform: translateY(-100%);64 }65 }6667 .animate-marquee {68 animation: marquee var(--duration) linear infinite;69 }7071 .animate-marquee-vertical {72 animation: marquee-vertical var(--duration) linear infinite;73 }74</style>
Files it writes
More from sv-blocks
All 64 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| progressive-blurprogressive-blur | sv-blocks | Components | Free | no deps · 2 files | |
| svgssvgs | sv-blocks | Components | Free | no deps · 21 files |
