{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "marquee",
  "title": "Marquee",
  "description": "An infinite horizontal scroller with a seamless loop. CSS only — no dependencies.",
  "files": [
    {
      "path": "registry/mewo/ui/marquee.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { cn } from \"@/lib/utils\"\n\nexport interface MarqueeProps extends React.ComponentProps<\"div\"> {\n  direction?: \"left\" | \"right\"\n  /** Seconds for one full loop. */\n  speed?: number\n  pauseOnHover?: boolean\n  /** Copies of the children in the track. The loop is only seamless while (repeat - 1) copies cover the container. */\n  repeat?: number\n}\n\n// Anything sequentially focusable by default, plus anything an author opted in with tabindex.\nconst FOCUSABLE =\n  'a[href], area[href], button, input, select, textarea, summary, iframe, audio[controls], video[controls], [contenteditable]:not([contenteditable=\"false\"]), [tabindex]:not([tabindex=\"-1\"])'\n\nexport function Marquee({\n  children,\n  direction = \"left\",\n  speed = 30,\n  pauseOnHover = true,\n  repeat = 4,\n  className,\n  style,\n  ...props\n}: MarqueeProps) {\n  // The duplicated tracks are what the loop paints for most of its cycle, so they have to stay\n  // clickable and selectable — `inert` would take all of that away along with focus, retargeting\n  // pointer events to the root and blocking text selection. aria-hidden keeps a duplicate out of\n  // the accessibility tree; tabindex=\"-1\" on its focusable descendants keeps it out of the tab\n  // order, so focus never lands in a subtree that announces nothing (WCAG 4.1.2). A ref callback\n  // declared here is a new function on every render, so React re-runs it whenever the children\n  // change — and it runs during commit, before the first paint.\n  const dropFromTabOrder = (track: HTMLDivElement | null) => {\n    track?.querySelectorAll<HTMLElement>(FOCUSABLE).forEach((element) => {\n      element.tabIndex = -1\n    })\n  }\n\n  return (\n    <div\n      data-slot=\"marquee\"\n      className={cn(\"group flex overflow-hidden [--gap:1.5rem]\", className)}\n      style={{ \"--marquee-duration\": `${speed}s`, ...style } as React.CSSProperties}\n      {...props}\n    >\n      {Array.from({ length: repeat }, (_, copy) => (\n        <div\n          key={copy}\n          ref={copy > 0 ? dropFromTabOrder : undefined}\n          data-marquee-copy={copy > 0 ? \"duplicate\" : \"original\"}\n          aria-hidden={copy > 0 ? true : undefined}\n          className={cn(\n            \"flex shrink-0 items-center gap-[var(--gap)] pr-[var(--gap)]\",\n            \"motion-safe:animate-[mewo-marquee_var(--marquee-duration)_linear_infinite]\",\n            direction === \"right\" && \"[animation-direction:reverse]\",\n            pauseOnHover && \"group-hover:[animation-play-state:paused]\"\n          )}\n        >\n          {children}\n        </div>\n      ))}\n    </div>\n  )\n}\n",
      "type": "registry:ui"
    }
  ],
  "css": {
    "@keyframes mewo-marquee": {
      "from": {
        "transform": "translateX(0)"
      },
      "to": {
        "transform": "translateX(-100%)"
      }
    }
  },
  "meta": {
    "added": "2026-09-15"
  },
  "categories": [
    "text"
  ],
  "type": "registry:ui"
}