Marquee
An infinite, seamless scrolling container ideal for logos, testimonials, and image galleries.
This
MarqueeBlock is engineered to be flawless. By exactly duplicating the content and using a precise CSS calculation (calc(-100% - gap)), the animation loops infinitely without any stuttering, lagging, or "snap back" resets that plague older implementations.You only supply one set of items — the block duplicates them and offsets the copy by
calc(-100% - gap), so the loop never snaps.Marquee
- Pass
childrenonce - — the block renders a second
aria-hiddencopy itself to close the loop. Duplicating them yourself gives a visible double run. fade- is off by default; on, it masks the first and last 10% so items dissolve instead of being clipped.
pauseOnHover- is off by default; on, it freezes the loop while the pointer is inside.
gap"4rem"- is a raw CSS length that both spaces the items and feeds the loop maths — a
%value breaks it. direction"left"- is the default: content travels leftwards.
Installation
New project? Follow the installation guide to set up Tailwind CSS, shadcn, the cn helper and lucide-react, register the @algorize-ui registry once, then copy your styles from the Themes page.
Install Marquee
components/ is written into your project. Copy any snippet from a Usage tab above and it runs.
Install dependencies
Nothing beyond the shared setup — Marquee needs only the cn helper and lucide-react, which the installation guide already put in place.
Examples
Reverse direction
- Set
direction"right" - to run the same animation backwards — pair it with a
leftrow above or below for a two-row logo wall.
Vertical
Vertical marquees need a bounded height — without one the container grows to fit both tracks and nothing appears to move.
- Use
direction"up" - to scroll the column upwards — it switches the container to
flex-coland animatestranslateY. direction"down"- runs the same column the other way.
fade- follows the axis on its own, masking the top and bottom edges here.
Speed
speed is a duration for one full pass, not a pixels-per-second rate — the same value moves faster with fewer items.
- Use
speed"slow" - for 40s per pass — a calm drift, good for large imagery.
speed"normal"- is the default: 20s per pass.
speed"fast"- gives 10s per pass — ticker pace.
speed{45}- a raw number sets the seconds per pass directly.
Without fade or pause
- Set
fade{false} - to drop the edge mask and let items run to a hard edge.
pauseOnHover{false}- keeps the loop running under the cursor. Both are the defaults.
Props Reference
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | Required | One set of items. The block duplicates them internally to close the loop. |
direction | "left" | "right" | "up" | "down" | "left" | Travel direction. Vertical values need a bounded height on the container. |
speed | "slow" | "normal" | "fast" | number | "normal" | Preset pace, or the duration of one full pass in seconds. |
pauseOnHover | boolean | false | Pauses the animation while the pointer is over the marquee. |
fade | boolean | false | Applies a gradient mask-image so items dissolve at both edges. |
gap | string | "1rem" | CSS gap between items. The loop math accounts for it, so any value stays seamless. |