Marquee
Drifts a decorative band of short items with pure CSS and rests as a static line under reduced motion.
- Frameworks
- Astro · React · Elements · Dioxus
- Registry
lumen add Marquee- Interaction
- Native markup
See it and copy it
Framework example
Choose Astro, React, Elements, or Dioxus to compare native usage against the shared visual output. Each example assumes the framework-level setup is already complete.
- North Studio
- Harbor Labs
- Summit Group
- Juniper Works
View Marquee code
Framework usage
Switch targets to compare the adapter code. This live preview runs the Astro example. Before copying an example, complete the matching framework setup; React, Elements, and Dioxus use their own behavior APIs.Width controls resize the preview container. Resize your browser to test viewport breakpoints.---
import { Badge, Marquee, Stack } from '@santi020k/lumen-astro'
---
<Stack gap="lg">
<Marquee items={['Build', 'Lead', 'Ship', 'Teach']} outline="alternate" separator="✦" velocity="follow" />
{/* Illustrative names only. Authored <li> items are exposed once; the loop clone is hidden and inert. */}
<Marquee fade gap="sm" label="Illustrative partner organizations" pauseLabel="Pause partner names" speed="slow">
<li><Badge variant="outline">North Studio</Badge></li>
<li><Badge variant="outline">Harbor Labs</Badge></li>
<li><Badge variant="outline">Summit Group</Badge></li>
<li><Badge variant="outline">Juniper Works</Badge></li>
</Marquee>
</Stack>import { Badge, Marquee, Stack } from '@santi020k/lumen-react'
export const Example = () => (
<>
<Stack gap="lg">
<Marquee items={['Build', 'Lead', 'Ship', 'Teach']} outline="alternate" separator="✦" velocity="follow" />
{/* Illustrative names only. Authored <li> items are exposed once; the loop clone is hidden and inert. */}
<Marquee fade gap="sm" label="Illustrative partner organizations" pauseLabel="Pause partner names" speed="slow">
<li><Badge variant="outline">North Studio</Badge></li>
<li><Badge variant="outline">Harbor Labs</Badge></li>
<li><Badge variant="outline">Summit Group</Badge></li>
<li><Badge variant="outline">Juniper Works</Badge></li>
</Marquee>
</Stack>
</>
)<script type="module">
import { defineLumenElements } from '@santi020k/lumen-elements/define'
defineLumenElements()
</script>
<lumen-stack gap="lg">
<lumen-marquee items={['Build', 'Lead', 'Ship', 'Teach']} outline="alternate" separator="✦" velocity="follow"></lumen-marquee>
{/* Illustrative names only. Authored <li> items are exposed once; the loop clone is hidden and inert. */}
<lumen-marquee fade gap="sm" label="Illustrative partner organizations" pause-label="Pause partner names" speed="slow">
<li><lumen-badge variant="outline">North Studio</lumen-badge></li>
<li><lumen-badge variant="outline">Harbor Labs</lumen-badge></li>
<li><lumen-badge variant="outline">Summit Group</lumen-badge></li>
<li><lumen-badge variant="outline">Juniper Works</lumen-badge></li>
</lumen-marquee>
</lumen-stack>use dioxus::prelude::*;
use lumen_dioxus::prelude::*;
#[component]
fn Example() -> Element {
rsx! {
Marquee {
items: vec!["Astro".to_string(), "React".to_string(), "Dioxus".to_string()],
fade: true,
}
Marquee { label: "Partners",
li { "Acme" }
li { "Harbor" }
}
}
}Choose your target
Add this component
Choose the package for your runtime. All adapters share the Lumen stylesheet. Use the matching registry command when you want a local wrapper for that framework.
pnpm add @santi020k/lumen-astrolumen add Marqueepnpm add @santi020k/lumen-reactlumen add Marquee --target reactpnpm add @santi020k/lumen-elementslumen add Marquee --target elementsAPI reference
Lumen-specific props and runtime attributes for the Astro primitive. Use the framework differences above and the copyable examples for React composition and Elements attributes; the public adapter types define their supported contracts.
| Attribute | Values | Default | Description |
|---|---|---|---|
| items | string[] | - | Short items rendered twice inside the track for a seamless loop. Blank items are dropped; without items or children nothing renders. Elements reads a JSON string array from items or the items property. |
| children / default slot | <li> elements | - | Used when items is empty. Rendered once in a visible list and again in an aria-hidden, inert loop clone with id attributes removed. Elements reads its direct children at the first render and wraps non-<li> children in a list item. separator and outline apply to items only. |
| separator | string | "•" | Mark rendered after each item and hidden from assistive technology. Pass an empty string to omit it. |
| speed | "slow" | "normal" | "fast" | "normal" | Maps to --ui-marquee-duration (70s, 40s, 20s). Override the custom property for any other pace. |
| duration | number (seconds) | - | Seconds per complete loop, clamped to 2-600. Overrides speed by setting --ui-marquee-duration inline; invalid values keep the speed preset. |
| direction | "start" | "end" | "up" | "down" | "start" | Drifts toward the inline start or end; RTL documents reverse the physical direction automatically. up and down loop vertically inside --ui-marquee-block-size (16rem). |
| gap | "sm" | "md" | "lg" | "xl" | responsive clamp | Sets the space between items from the shared spacing scale. Omit it to keep the responsive default. |
| fade | boolean | false | Masks both travel edges while motion is allowed. Width follows --ui-marquee-fade-size (3rem). |
| pauseControl | boolean | true | Renders a native checkbox at the inline-end corner that pauses the animation without JavaScript (WCAG 2.2.2). Hidden under reduced motion. Elements uses pause-control="false" to omit it. |
| pauseLabel | string | "Pause animation" | Visible label and accessible name of the pause checkbox. Elements uses pause-label. |
| pauseOnHover | boolean | true | Pauses the animation on hover and focus-within. Focus inside the loop always pauses it. Elements uses pause-on-hover="false" to disable. |
| velocity | "none" | "boost" | "follow" | "none" | Boost speeds the loop up with window scroll speed (one extra speed per 220 px/s, up to seven times) and eases it back; follow also reverses it while the page scrolls up. Inner scroll containers do not drive it. In Astro it requires <UIPrimitives />, which loads a small controller only for these bands. A paused loop stays paused and reduced motion stays still. |
| outline | "none" | "alternate" | "none" | Renders every second item as brand-stroked outline text; forced colors fall back to a solid CanvasText fill. |
| decorative | boolean | true for items, false for children | Keeps the animated items hidden from assistive technology (the pause control stays reachable). Set false to also expose one visually hidden plain list and a named group. With children, true hides the whole track with aria-hidden and inert. |
| label | string | none | Accessible group name used only when decorative is false. Required with children, which are not decorative by default. |
| class, className | string | "" | Merges custom classes with the generated ui-* root classes. |
| ...native attributes | HTML attributes | - | Forwards standard attributes to the root element unless the component consumes them. |
Customize Marquee
Start with semantic theme tokens and a class on the public component. Keep its accessible name, focus treatment, and interaction state intact.
.product-marquee {
--surface: 0 0% 100%;
--ink: 220 20% 15%;
--line: 220 15% 82%;
}Apply product-marquee through Astro's class, React's className, or the custom element's class. Verify foreground and background contrast in both schemes.
| Hook | Values | Default | Contract |
|---|---|---|---|
| class, className | string | "" | Merges custom classes with the generated ui-* root classes. |
Use the documented hooks above and adapter types when targeting component states. Theme guide · Accessibility verification scope
Keyboard interactions
Keyboard behavior provided by native HTML controls.
| Key | Action |
|---|---|
| Tab | Reaches focusable children in the visible list once, which pauses the loop; the clone is inert. Then reaches the pause control. |
| Space | Toggles the native pause control. |