Metric ticker
A strip of live numbers for a dashboard header or a status bar: each a label, a figure, a change and a trend.

The figures are counters: with the package's script their digits roll when a re-render changes them; without it the new number simply arrives. Everything else is plain Blade and CSS, the marquee included.
Use it
<x-ds::metric-ticker label="Live metrics" :items="[
['label' => 'MRR', 'value' => $mrr, 'format' => ['prefix' => '$'], 'delta' => 3.2, 'trend' => $mrrTrend, 'tone' => 'success'],
['label' => 'Error rate', 'value' => $errors, 'format' => ['suffix' => '%', 'decimals' => 2], 'delta' => -12, 'rising' => 'bad'],
['label' => 'Queue', 'value' => $queued, 'href' => route('horizon.index')],
]" />
With Livewire, wire:poll the component that holds it and the figures roll.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
items | array | [] | The figures, in order. Each label and value; see below. |
size | sm md lg | md | The figures at body, title or display size. |
label | string | Metrics | The strip's name. |
dividers | bool | true | A rule between the items. |
scroll | wrap scroll marquee | wrap | See Modes. |
pauseLabel | string | Pause | The marquee's pause button's name. |
Per item:
| Key | What it does |
|---|---|
label, value | Needed. A value that is not a number is shown as written. |
format | The counter's format: prefix, suffix, decimals, compact. |
delta | A percentage, as on stat tile: its sign picks the colour, and an arrow says which way. |
rising | good (default) or bad: what a rise means. With bad a fall is drawn in success and a rise in danger; the sign and the arrow stay as they are. The same word as stat tile's and slope chart's. |
trend | A list of numbers, drawn as a sparkline in tone. |
tone | success warning danger accent neutral. |
href | Makes the item a link. |
announce | Makes this one figure a polite live region. |
Modes
wrap: the items flow onto as many lines as they need. The default.scroll: one line that scrolls sideways, snapping to each item. The scroll box takes focus so a keyboard can scroll it.marquee: one line, moving. It pauses while the pointer or focus is on it, and has a pause button. Under reduced motion it does not move: it is thescrollrow. The loop's second copy is hidden from assistive technology and inert.
Accessibility
- A named
groupholding a list. Each figure reads as its label and number. - Not a live region. A ticker that spoke every change would never stop.
Mark the one figure someone is waiting on with
announce. - Every delta has an arrow as well as a colour, and a sign.
- The marquee meets WCAG 2.2.2: it can be paused, and it stops for hover, focus and reduced motion.
Don't
- Don't use the marquee for figures people need to read. Use
wrap. - Don't announce more than one figure.
- Don't put a headline number here. Use a stat tile.
More in specs/metric-ticker.md.
From the package repo: edit this page on GitHub.