Marketing sectionsMarquee
Searchastronomic.dev# Marquee
To build your own moving row: a set of items that scrolls in a loop under a label or a heading, still for readers who turn motion off. For a ready layout, use MarqueeLogos, MarqueeText or MarqueeTitle.
Interactive: inline script.
## Usage
```astro
import Marquee from "@astronomic-dev/ui/components/Marquee.astro";
```
## Examples
### Slots
The section is a shell: the eyebrow, the heading and the text always show in that order, then the moving row. The default slot is the row's items, as <li>s, written once and shown twice, so the loop has no seam. setClass sets the row's type and gaps. MarqueeLogos, MarqueeText and MarqueeTitle are recipes built on it.
```astro
---
import Badge from "@astronomic-dev/ui/components/Badge.astro";
import Marquee from "@astronomic-dev/ui/components/Marquee.astro";
const parts = ["Hero", "Navbar", "Features", "Pricing", "Testimonials", "Footer"];
---
<div class="mx-auto max-w-6xl px-6 py-16">
<Marquee heading="Parts in the kit" text="A few of the sections every Astronomic theme is built from, passing by. Hover the row to stop it." setClass="text-subhead text-fg">
<Badge slot="eyebrow">Astronomic UI</Badge>
{parts.map((part) => <li>{part}</li>)}
</Marquee>
</div>
```
## Props
### Marquee
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string` | None | The region's name, such as "Recent clients", in small muted type above the row (or beside it, in MarqueeLogos). With a heading, the heading names the region instead. One of heading, label or labelledBy is required: without any the build stops. |
| `labelledBy` | `string` | None | The id of your own element that names the region, such as a label you show beside the strip. With it the part shows no label of its own and the region is named by your element only, so a screen reader hears the name once (MarqueeLogos then takes no labelLayout). One of heading, label or labelledBy is required; a heading wins over it. |
| `heading` | `string` | None | The section heading, in the section role in display type. With it, it names the region. |
| `emphasis` | `boolean` | `false` | Turn one *phrase* in the heading into <em>: exactly two asterisks around text with no space inside. Off by default, so the heading shows as typed. |
| `mark` | `string` | None | A short mark after the heading, such as "(12)", in small muted type, outside the heading. Shown only with a heading. |
| `markLabel` | `string` | None | What the mark says to a screen reader, such as "12 clients": the mark is then hidden from screen readers and this is read in its place. |
| `text` | `string` | None | One or two sentences under the heading, in the lead role, muted. Shown only with a heading. |
| `headingTag` | `"h2" \| "h3" \| "h4"` | `"h2"` | The heading element. |
| `speed` | `"slow" \| "normal" \| "fast"` | `"normal"` | How long one loop takes: the theme's --ui-marquee-duration (40s when it sets none) times 1.5 for slow, 1 for normal or 0.6 for fast. |
| `direction` | `"start" \| "end"` | `"start"` | start: the row runs toward the start of the line (left, or right on a right-to-left page). end: the other way. |
| `pause` | `boolean` | `false` | Shows the page's one MotionPause button in the header. Pass it on the first marquee of the page only: one button stops every marquee and autoplaying video. |
| `decorative` | `boolean` | `false` | For recipes. The moving row is decoration that the heading already says (MarqueeTitle): the whole row is hidden from screen readers. |
| `contentClass` | `string` | None | For recipes. Classes for the row that holds the header and the moving row, such as a label column. It sits inside the marquee container, so its classes can query it (@3xl/marquee:...). |
| `headerClass` | `string` | None | For recipes. Classes for the header: the heading or the label, and the pause button. |
| `trackClass` | `string` | None | For recipes. Classes for the track that moves, which holds the list and its copy. |
| `setClass` | `string` | None | For recipes. Classes for each copy of the list (a <ul>), such as its type and the gaps between items. |
| `class` | `string` | None | More classes for the <section>, merged with cn(), so yours win on conflicts. The root is a named size container (inline-size containment): in a shrink-to-fit parent it collapses, so give it a width there. |
| Slot | Description |
| --- | --- |
| `default` | The row's items, as <li> elements. Written into both copies, so an id inside one would repeat: give items no ids. |
| `eyebrow` | A short line above the heading, such as a Badge. Shown only with a heading. |
Any other attribute goes on the <section>.
## Accessibility
- It is a region (<section>) named by its heading or its label: one of them is required. The heading id is unique on the page.
- The items are a list, written twice: the first copy is the real list, the second is hidden from screen readers (aria-hidden) and inert, so a screen reader hears each item once and the Tab key reaches each link once.
- The moving row takes no focus of its own; the links inside it do. Hovering it pauses it, so a link never slides away from the pointer. Focusing a link inside it turns it still: the copy hides and the set wraps in rows, as with reduced motion, so the focused link sits whole and in view; it moves again when focus leaves.
- Still with no click needed when the reader asks for reduced motion or the theme is calm: one copy of the list, wrapping onto more lines, with nothing hidden.
- Anything that moves for more than five seconds needs a way to stop it (WCAG 2.2.2): pass pause on the page's first marquee for the one Pause motion button, which stops every marquee for the visit.
- Right to left, the row runs the other way, so start is still the start of the line.
Marquee
FreeTo build your own moving row: a set of items that scrolls in a loop under a label or a heading, still for readers who turn motion off. For a ready layout, use MarqueeLogos, MarqueeText or MarqueeTitle.
- File
- Marquee.astro
- Group
- Marketing sections
- Kind
- Interactive: inline script
- Examples
- 1
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
Slots
The section is a shell: the eyebrow, the heading and the text always show in that order, then the moving row. The default slot is the row's items, as <li>s, written once and shown twice, so the loop has no seam. setClass sets the row's type and gaps. MarqueeLogos, MarqueeText and MarqueeTitle are recipes built on it.
This preview did not load.
main.astro
examples/marquee/main.astro
---
import Badge from "@astronomic-dev/ui/components/Badge.astro";
import Marquee from "@astronomic-dev/ui/components/Marquee.astro";
const parts = ["Hero", "Navbar", "Features", "Pricing", "Testimonials", "Footer"];
---
<div class="mx-auto max-w-6xl px-6 py-16">
<Marquee heading="Parts in the kit" text="A few of the sections every Astronomic theme is built from, passing by. Hover the row to stop it." setClass="text-subhead text-fg">
<Badge slot="eyebrow">Astronomic UI</Badge>
{parts.map((part) => <li>{part}</li>)}
</Marquee>
</div>Minimal · Light