Marquee
マーキー
An infinite scroller running on a single CSS keyframe↗↗ — the children are duplicated once and the track translates by half its width, so the loop is seamless without measuring anything at runtime. Hover to pause.
Installation
Install the following dependencies:1
npm install tailwind-mergenpm install clsxCopy and paste the following code into a new component file:2
How to use it3
Props
Marquee
| Name | Default | Description |
|---|---|---|
| children | — | ReactNode MarqueeContent and optionally two MarqueeFade |
| className | — | string Additional classes on the clipping container |
MarqueeContent
| Name | Default | Description |
|---|---|---|
| children | — | ReactNode MarqueeItem elements. They are duplicated once to make the loop seamless |
| speed | 40 | number Seconds for one full cycle. Higher is slower |
| direction | "left" | "left" | "right" Scroll direction |
| pauseOnHover | true | boolean Pause the animation while the pointer is over the marquee |
MarqueeFade
| Name | Default | Description |
|---|---|---|
| side | — | "left" | "right" Which edge to fade out |
| className | — | string Additional classes, typically to match the background it sits on |
MarqueeItem
| Name | Default | Description |
|---|---|---|
| children | — | ReactNode Content of a single item |
| className | — | string Additional classes, typically horizontal spacing |