Marquee

Marquee

An animated scrolling container that creates a continuous, infinite loop of content with support for both horizontal and vertical directions.


Import

tsx
import { Marquee } from "asheeui";

Usage

tsx
import { Marquee } from "asheeui";
export default function Basic() {
return (
<div className="w-full">
<Marquee>
<div className="rounded-lg bg-secondary/20 px-6 py-3">Item 1</div>
<div className="rounded-lg bg-secondary/20 px-6 py-3">Item 2</div>
<div className="rounded-lg bg-secondary/20 px-6 py-3">Item 3</div>
<div className="rounded-lg bg-secondary/20 px-6 py-3">Item 4</div>
</Marquee>
</div>
);
}

Examples

Axis

Horizontal scrolling
Horizontal scrolling
Item 1
Item 2
Item 3
Item 4

Direction

Scrolling forward →
Scrolling forward →
← Scrolling reverse
← Scrolling reverse

Speed presets

Slow scroll
Slow scroll
Normal scroll
Normal scroll
Fast scroll
Fast scroll

Custom speed

Very slow (30 seconds per loop)
Very slow (30 seconds per loop)
Very fast (5 seconds per loop)
Very fast (5 seconds per loop)

Gap

Wide
Gap
Between
Items
Tight
Gap

Pause on hover

Hover to pause scrolling
Hover to pause scrolling

Fade edges

Smooth fade on edges
Smooth fade on edges

With images

React logo
TypeScript logo
Tailwind CSS logo
Next.js logo
Node.js logo

Combined example

Feature 1
Feature 2
Feature 3
Feature 4

Props

PropTypeDefaultDescription
childrenReactNode[]NoneArray of items to scroll (required)
axis"x" | "y""x"*Scroll direction axis
direction"forward" | "reverse""forward"*Scroll direction
speed"slow" | "normal" | "fast" | number"normal"*Scroll speed (preset or seconds per loop)
gapstring"1.5rem"*Gap between items
pauseOnHoverbooleanfalse*Pause animation on hover
fadeEdgesbooleanfalse*Fade edges of the container
itemClassNamestringNoneExtra classes applied to each item
classNamestringNoneExtra classes, merged with internal styles

* Falls back through Global Configuration if not set. See below.


Global Configuration

Marquee reads defaults from four places, in this order of precedence:

  1. Instance prop: set directly on <Marquee />
  2. Component config: components.marquee in your ashee.config
  3. Built-in fallback: component's internal default values

Component config

ts
// ashee.config.ts
import type { ExternalConfig } from "asheeui";
export const config: ExternalConfig = {
components: {
marquee: {
axis: "x",
direction: "forward",
speed: "normal",
gap: "1.5rem",
pauseOnHover: true,
fadeEdges: true,
},
},
};

Built-in fallbacks

ts
{
axis: "x",
direction: "forward",
speed: "normal",
gap: "1.5rem",
pauseOnHover: true,
fadeEdges: true,
}

Accessibility

  • Uses aria-hidden on duplicate content sets to prevent screen reader duplication
  • Pauses on hover by default to support users with vestibular disorders
  • Animation respects prefers-reduced-motion via CSS
  • Content remains accessible even when paused

Notes

  • Speed Values: The preset speeds correspond to slow (50s), normal (30s), and fast (15s) per full loop. You can also provide a custom number of seconds.
  • Duplication: The marquee automatically duplicates its children to create the infinite scrolling effect. The duplicate set is hidden from screen readers with aria-hidden.
  • Fade Edges: When enabled, the edges of the container fade to the background color for a smoother visual effect.
  • Axis: x scrolls horizontally, y scrolls vertically.
  • Direction: forward scrolls in the natural direction (left or up), reverse scrolls in the opposite direction.
Previous

← Link

Next

Modal →