Skip to content
Haze UI

Marquee

Endless horizontal strip that loops its children, pauses on hover and focus, and can fade out at both edges.

pnpm dlx shadcn@latest add @haze/marquee
Open preview in a new tab
Liveno JavaScript

When to use

  • A decorative strip of customer names or logos under a hero
  • A row of short tags or integrations where seeing all of them at once is not required
  • Many items that would not fit in one row on a narrow screen

When not to use

  • Anything people must read, such as prices, steps or legal text; moving text is hard to read and to stop
  • A page that needs a visible pause button; this component has none and pauses only on hover and keyboard focus
  • Navigation or interactive content; the second copy is hidden from assistive technology

Installation

Add the Haze registry to components.json once, then install Marquee with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/marquee
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
durationnumber40Seconds for one full loop, set as an inline animation-duration.
gap"sm" | "md" | "lg""md"Space between items: 16, 32 or 48 px. The same value pads the end of each copy so the loop has no jump.
fadebooleanfalseSoftens both edges with a CSS mask that goes from transparent to black.
classstring–Extra classes on the clipping box.
default slot*slot–The items. The slot is rendered twice; the second copy is aria-hidden and inert.

Accessibility

  • Moving content that lasts more than 5 seconds needs a way to pause it (WCAG 2.2.2). This strip pauses only on hover and keyboard focus inside it, with no button, so use it for decoration only.
  • The theme turns the animation off under prefers-reduced-motion; the track then wraps into centered rows that fit the box, the duplicate copy is hidden and the edge fade is removed, so every item stays visible.
  • The duplicate copy is aria-hidden and inert, so a screen reader reads each item once and keyboard focus never lands in it; keep focusable controls out of the strip.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Marquee" with `npx shadcn@latest add @haze/marquee`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import Marquee from "@/components/haze/ui/marquee.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/marquee.md

  • Customize with real content

    Adapt the Haze marquee ui for our product. Replace the demo values of these props with our real content: duration, gap, fade, class, default slot. Keep the layout, the heading level rules and these accessibility details: Moving content that lasts more than 5 seconds needs a way to pause it (WCAG 2.2.2). This strip pauses only on hover and keyboard focus inside it, with no button, so use it for decoration only. The theme turns the animation off under prefers-reduced-motion; the track then wraps into centered rows that fit the box, the duplicate copy is hidden and the edge fade is removed, so every item stays visible. The duplicate copy is aria-hidden and inert, so a screen reader reads each item once and keyboard focus never lands in it; keep focusable controls out of the strip. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using marquee, check it fits: use it when a decorative strip of customer names or logos under a hero; a row of short tags or integrations where seeing all of them at once is not required; many items that would not fit in one row on a narrow screen. Avoid it when anything people must read, such as prices, steps or legal text; moving text is hard to read and to stop; a page that needs a visible pause button; this component has none and pauses only on hover and keyboard focus; navigation or interactive content; the second copy is hidden from assistive technology. Alternatives: @haze/logo-mark, @haze/badge.

Dependencies

  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog