Modus UI

Marquee

Web (React)

A seamless, infinitely scrolling row of elements.

A highly resilient marquee. Instead of using fragile CSS keyframes, it drives the scroll with Framer Motion's useAnimationFrame against a measured bounding box. This guarantees perfectly seamless wrapping without visual jumps, and allows you to pause the scroll instantly on hover.

Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8

Installation

CLI

npx @modus-ui/cli add marquee

Manual

  1. Copy the code from the component tab.
  2. Create a file at components/ui/marquee.tsx.
  3. Paste the code.

Usage

tsx
import { Marquee } from "@/components/ui/marquee";

export default function Example() {
  return (
    <Marquee speed={50} direction="left" pauseOnHover>
      <div className="mx-4">Logo 1</div>
      <div className="mx-4">Logo 2</div>
      <div className="mx-4">Logo 3</div>
    </Marquee>
  );
}

Props

PropTypeDefaultDescription
childrenReactNode-The elements to scroll.
speednumber60Pixels travelled per second.
direction"left" | "right""left"The direction to scroll.
pauseOnHoverbooleantruePause the scrolling when hovered.
fadeEdgesbooleantrueFade the leading and trailing edges into the background.
classNamestring""-

Comments

  • No comments yet.