GooseUI

Components

Marquee

New

An endless ticker for logos, tags or news. It is a server component: the content is rendered several times and the track moves by one copy with a CSS animation. The only client code is a tiny helper that eases the speed to zero on hover and focus. Edges fade out with a mask, copies are hidden from screen readers.

Browser Support

inert

Removes inactive content from interaction

Your browser:
:focus-within

Pauses movement while focused

Your browser:
Masks

Creates fading edges

Your browser:

Preview

Hover the ticker, it slows down smoothly and speeds up when you leave.

Orbitly
Squarely
Trigon
Hexwork
Starfold
Pillbox
Diamondo
Ringside

Installation

npx shadcn@latest add @gooseui/marquee
pnpm dlx shadcn@latest add @gooseui/marquee
yarn dlx shadcn@latest add @gooseui/marquee
bunx --bun shadcn@latest add @gooseui/marquee

Usage

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

export default function Example() {
  return (
    <Marquee duration={20} pauseOnHover>
      <img src="/logos/one.svg" alt="One" className="h-8" />
      <img src="/logos/two.svg" alt="Two" className="h-8" />
      <img src="/logos/three.svg" alt="Three" className="h-8" />
    </Marquee>
  )
}

Examples

Two rows in opposite directions

reverse flips the direction. Each row has its own duration and gap. The rows are short, so repeat renders four copies.

OrbitlySquarelyTrigonHexwork
StarfoldPillboxDiamondoRingside
<Marquee duration={12} repeat={4} gap={16}>{tags}</Marquee>
<Marquee duration={8} repeat={4} gap={16} reverse>{moreTags}</Marquee>

Vertical

vertical scrolls the items upwards. Give the marquee a fixed height.

Release 2.4 is out
New regions in Asia
Dark mode for reports
Faster exports
Audit log for teams
<Marquee vertical duration={14} gap={12} pauseOnHover className="h-56 w-64">
  {updates.map((text) => (
    <div key={text} className="rounded-lg border bg-card px-4 py-3 text-sm">
      {text}
    </div>
  ))}
</Marquee>

Few items

CSS cannot measure the content, so the number of copies is set by repeat. One copy times repeat minus one must cover the container, otherwise a gap appears at the end of the loop.

Orbitly
Squarely
<Marquee repeat={8} gap={48}>
  <Logo name="Orbitly" />
  <Logo name="Squarely" />
</Marquee>

Props

PropTypeDefaultDescription
childrenReactNode-Items of the ticker
durationnumber20Seconds for one copy of the content to scroll past
repeatnumber2How many copies to render. Raise it when the content is narrower than the container
reversebooleanfalseMove right (or down) instead of left (or up)
verticalbooleanfalseScroll vertically. Needs a fixed height
pauseOnHoverbooleanfalseSlow down to a stop while hovered
stopDurationnumber500Milliseconds to slow down on hover or focus and to speed up again
gapnumber | string32Space between items: number in px or any CSS length
fadenumber48Width of the faded edges in px, 0 turns the mask off
classNamestring-Additional CSS classes
...propsComponentProps<"div">-Any other div attributes

Features

  • Almost no JavaScript: the ticker is a Server Component, about 60 lines of client code brake it smoothly; without scripts it still runs and pauses at once
  • Accessible: copies get aria-hidden and inert, the ticker slows to a stop while focus is inside
  • Reduced motion: with prefers-reduced-motion the ticker stops and wraps into rows
  • No dependencies: keyframes live inside the component