# Marquee

> An eased conveyor of repeated content that dissolves into soft edge fades and, on hover or focus, brakes smoothly to a stop and pulls away again instead of freezing.

- Package: `fancy-ui-svelte` (Svelte 5 + Tailwind CSS v4)
- Category: Layout
- Tags: marquee, scrolling, animation, layout, infinite, edge fade, web animations
- Docs: https://fancy-ui.rama.app/docs/components/marquee
- Source: https://github.com/RamaHerbin/fancy-ui/tree/main/src/lib/fancy-ui/marquee

## Import

```svelte
<script lang="ts">
  import { Marquee } from 'fancy-ui-svelte';
</script>
```

Setup (once per project): `npm install fancy-ui-svelte`, then add `@import "fancy-ui-svelte/tailwind.css";` after `@import "tailwindcss";` in your main CSS file. Full guide: https://fancy-ui.rama.app/llms.txt

React: `import { Marquee } from 'fancy-ui-react';` (`class` becomes `className`, snippets become `ReactNode`, DOM callbacks are camel-cased; exact names on https://fancy-ui.rama.app/docs/components/react/marquee.md).

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `reverse` | `boolean` | `false` | Reverse the scroll direction |
| `pauseOnHover` | `boolean` | `false` | Ease the conveyor to a stop while hovered or focused, and back up on leave |
| `vertical` | `boolean` | `false` | Scroll vertically instead of horizontally |
| `repeat` | `number` | `4` | Number of times to repeat children for seamless loop |
| `fade` | `boolean` | `true` | Dissolve items at both edges with an eased gradient mask (width via --marquee-fade, default 12%) |
| `speed` | `number` | `1` | Speed multiplier on top of --duration (2 = twice as fast) |
| `ReviewCard.img` | `string` | — | Avatar image URL |
| `ReviewCard.name` | `string` | — | Reviewer's name |
| `ReviewCard.username` | `string` | — | Reviewer's handle, shown under the name |
| `ReviewCard.body` | `string` | — | Text of the review |

## Snippets

| Snippet | Description |
| --- | --- |
| `children` | Content to repeat and scroll |

## Examples

### Basic Usage

Two rows of review cards moving in opposite directions inside a nested frame; hover a row to brake it.

```svelte
<script lang="ts">
	import { Marquee, ReviewCard } from "fancy-ui-svelte";

	const reviews = [
		{
			name: "Jack",
			username: "@jack",
			body: "I've never seen anything like this before. It's amazing.",
			img: "https://avatar.vercel.sh/jack",
		},
		{
			name: "Jill",
			username: "@jill",
			body: "I don't know what to say. I'm speechless. This is amazing.",
			img: "https://avatar.vercel.sh/jill",
		},
		{
			name: "John",
			username: "@john",
			body: "I'm at a loss for words. This is amazing. I love it.",
			img: "https://avatar.vercel.sh/john",
		},
		{
			name: "Jane",
			username: "@jane",
			body: "I'm at a loss for words. This is amazing. I love it.",
			img: "https://avatar.vercel.sh/jane",
		},
		{
			name: "Jenny",
			username: "@jenny",
			body: "I'm at a loss for words. This is amazing.",
			img: "https://avatar.vercel.sh/jenny",
		},
		{
			name: "James",
			username: "@james",
			body: "I'm at a loss for words. This is amazing.",
			img: "https://avatar.vercel.sh/james",
		},
	];

	const firstRow = reviews.slice(0, 3);
	const secondRow = reviews.slice(3);
</script>

<!-- Outer shell + inner panel: the same nested hairline frame the cards use. -->
<div
	class="w-full rounded-[22px] border border-black/[.08] bg-[#f4f4f5] p-1.5 dark:border-white/[.08] dark:bg-[#0b0b0c]"
>
	<div
		class="relative flex flex-col gap-1 overflow-hidden rounded-2xl border border-black/[.06] bg-white pt-4 pb-3 dark:border-white/[.06] dark:bg-[#111113]"
	>
		<div class="mb-2 flex items-center justify-between px-5">
			<p class="text-[13px] font-medium tracking-[-0.01em] text-zinc-900 dark:text-zinc-100">
				What people say
			</p>
			<span
				class="rounded-full border border-black/[.08] px-2.5 py-0.5 font-mono text-[11px] text-zinc-500 dark:border-white/[.08]"
			>
				hover to brake
			</span>
		</div>
		<Marquee pauseOnHover class="[--duration:30s]">
			{#each firstRow as review (review.username)}
				<ReviewCard {...review} />
			{/each}
		</Marquee>
		<Marquee reverse pauseOnHover class="[--duration:30s]">
			{#each secondRow as review (review.username)}
				<ReviewCard {...review} />
			{/each}
		</Marquee>
	</div>
</div>
```

### Vertical

Two vertical columns with wider edge fades.

```svelte
<script lang="ts">
	import { Marquee, ReviewCard } from "fancy-ui-svelte";

	const reviews = [
		{
			name: "Jack",
			username: "@jack",
			body: "I've never seen anything like this before.",
			img: "https://avatar.vercel.sh/jack",
		},
		{
			name: "Jill",
			username: "@jill",
			body: "I'm speechless. This is amazing.",
			img: "https://avatar.vercel.sh/jill",
		},
		{
			name: "John",
			username: "@john",
			body: "I'm at a loss for words.",
			img: "https://avatar.vercel.sh/john",
		},
	];
</script>

<div
	class="w-full rounded-[22px] border border-black/[.08] bg-[#f4f4f5] p-1.5 dark:border-white/[.08] dark:bg-[#0b0b0c]"
>
	<div
		class="relative flex h-[480px] flex-row items-stretch justify-center overflow-hidden rounded-2xl border border-black/[.06] bg-white px-4 dark:border-white/[.06] dark:bg-[#111113]"
	>
		<Marquee vertical pauseOnHover class="[--duration:24s] [--marquee-fade:18%]">
			{#each reviews as review (review.username)}
				<ReviewCard {...review} />
			{/each}
		</Marquee>
		<Marquee vertical reverse pauseOnHover class="[--duration:24s] [--marquee-fade:18%]">
			{#each reviews as review (review.username)}
				<ReviewCard {...review} />
			{/each}
		</Marquee>
	</div>
</div>
```

### Eased Stop

Hover a strip: the conveyor decelerates to a stop and re-accelerates on leave. Also shows the speed prop.

```svelte
<script lang="ts">
	import { Marquee } from "fancy-ui-svelte";

	const words = [
		"Svelte 5",
		"Runes",
		"Tailwind v4",
		"TypeScript",
		"Web Animations",
		"Reduced motion",
		"SSR safe",
		"MIT License",
	];
</script>

<!-- Hover a strip: the conveyor brakes to a stop instead of freezing, and pulls away again on leave. -->
<div
	class="w-full rounded-[22px] border border-black/[.08] bg-[#f4f4f5] p-1.5 dark:border-white/[.08] dark:bg-[#0b0b0c]"
>
	<div
		class="flex flex-col gap-3 rounded-2xl border border-black/[.06] bg-white py-6 dark:border-white/[.06] dark:bg-[#111113]"
	>
		<Marquee pauseOnHover speed={1.5} class="[--duration:30s] [--gap:0.75rem]">
			{#each words as word (word)}
				<span
					class="rounded-full border border-black/[.08] bg-[#fafafa] px-3.5 py-1.5 font-mono text-[12px] tracking-tight whitespace-nowrap text-zinc-600 dark:border-white/[.08] dark:bg-[#141416] dark:text-zinc-400"
				>
					{word}
				</span>
			{/each}
		</Marquee>
		<Marquee pauseOnHover reverse class="[--duration:40s] [--gap:2.5rem]">
			{#each words as word (word)}
				<span
					class="text-[28px] font-medium tracking-[-0.03em] whitespace-nowrap text-zinc-900 dark:text-zinc-100"
				>
					{word}
				</span>
			{/each}
		</Marquee>
		<p class="px-6 text-center font-mono text-[11px] text-zinc-500">
			Hover a strip to brake it to a stop
		</p>
	</div>
</div>
```
