Marquee
Your content written once and repeated to fill, at a speed in pixels a second, in four directions; it waits under the pointer and with focus, pauses on a button, and stands still for reduced motion.
Usage
Usage
import { Component, ViewEncapsulation } from '@angular/core';import { RouterLink } from '@angular/router';import { ScLink, ScMarquee, ScMarqueeContent, ScMarqueePause,} from '@semantic-components/ui';import { SiPauseIcon, SiPlayIcon } from '@semantic-icons/lucide-icons';Anatomy
The marquee holds your content, written once in an ng-template, and a pause button beside it. The look is your content's: links, cards, text.
import { ScMarquee, ScMarqueeContent, ScMarqueePause } from '@semantic-components/ui';<section aria-label="Our users"> <div scMarquee #logos="scMarquee"> <ng-template scMarqueeContent>…your content, once…</ng-template> <button scMarqueePause>…Pause or Play, from logos.paused()…</button> </div></section>How it moves
The template is repeated as often as it takes to fill what shows, and once more, so the loop is seamless; the copies are inert and hidden from screen readers. speed is in pixels a second: short and long content move at the same pace. It moves with the Web Animations API and pauses where it is. A vertical marquee needs a height.
direction is logical: start (the default) moves toward the reading start — to the left, and to the right in a right-to-left page, as Arabic news tickers run — end the other way; or up and down. Nothing to change for right to left. For a way that never flips, left or right: start and end are turned into them.
Accessibility
- It waits under the pointer, and with focus in the content — Tab into a link — then goes on.
- The pause button stops it (WCAG 2.2.2); write its name from
paused()(Pause, Play). - With reduced motion it doesn't move: one copy, a row to scroll (data-still).
- Screen readers and Tab meet your content once; name the region it is in.
Examples
Testimonials
“It just works, and it reads well.”
“Our forms finally feel finished.”
“Accessible without trying hard.”
“The docs answered every question.”
“Small parts, composed: exactly right.”
“It just works, and it reads well.”
“Our forms finally feel finished.”
“Accessible without trying hard.”
“The docs answered every question.”
“Small parts, composed: exactly right.”
import { Component, ViewEncapsulation } from '@angular/core';import { ScFrame, ScMarquee, ScMarqueeContent } from '@semantic-components/ui';
/** Two rows, going opposite ways. */@Component({ selector: 'app-testimonials-marquee-demo', imports: [ScFrame, ScMarquee, ScMarqueeContent], template: ` <section aria-label="What people say" class="w-full space-y-4"> <div scMarquee fade>Vertical
“It just works, and it reads well.”
“Our forms finally feel finished.”
“Accessible without trying hard.”
“The docs answered every question.”
“Small parts, composed: exactly right.”
import { Component, ViewEncapsulation } from '@angular/core';import { ScFrame, ScMarquee, ScMarqueeContent } from '@semantic-components/ui';
/** A column, going up: give it a height. */@Component({ selector: 'app-vertical-marquee-demo', imports: [ScFrame, ScMarquee, ScMarqueeContent], template: ` <section aria-label="Reviews" class="h-80"> <div scMarquee direction="up" fade class="h-full">Ticker
import { Component, ViewEncapsulation } from '@angular/core';import { ScFrame, ScMarquee, ScMarqueeContent } from '@semantic-components/ui';
/** Headlines, with your separators — text is content like any other. */@Component({ selector: 'app-ticker-marquee-demo', imports: [ScFrame, ScMarquee, ScMarqueeContent], template: ` <section scFrameSpeed
import { Component, ViewEncapsulation } from '@angular/core';import { ScFrame, ScMarquee, ScMarqueeContent } from '@semantic-components/ui';
/** In pixels a second: short and long content move at the same pace. */@Component({ selector: 'app-speed-marquee-demo', imports: [ScFrame, ScMarquee, ScMarqueeContent], template: ` <div class="w-full space-y-3"> <div scMarquee [speed]="40" scFrame size="sm" class="py-2">RTL
import { Dir } from '@angular/cdk/bidi';import { Component, LOCALE_ID, ViewEncapsulation } from '@angular/core';import { ScFrame, ScMarquee, ScMarqueeContent } from '@semantic-components/ui';
/** * In a right-to-left page: toward the reading start is toward the right — as * Arabic news tickers run — with nothing to change. */@Component({ selector: 'app-rtl-marquee-demo',API reference
Each part takes class, merged over its own (cn: a later class wins).
| Part | Selector | Description |
|---|---|---|
ScMarquee | [scMarquee] | Repeats its content to fill and moves it; waits under the pointer and with focus; still for reduced motion (data-still). exportAs scMarquee: paused(). |
ScMarqueeContent | ng-template[scMarqueeContent] | Your content, written once: the marquee stamps the copies. |
ScMarqueePause | button[scMarqueePause] | Pauses and plays it: the style’s button (outline, icon-sm). Write its icon and name from paused(). |
| Input | Type | Default | Description |
|---|---|---|---|
direction | 'start' | 'end' | 'left' | 'right' | 'up' | 'down' | 'start' | Toward the reading start (right, right to left) or end; left or right whatever the page; up or down. |
speed | number | 40 | Pixels a second, whatever the content’s length. |
gap | number | 16 | Space between items and copies, in pixels. |
paused | boolean | false | Two-way: stopped, by your pause button. |
fade | boolean | false | Its edges fade out. |