Velocity X Components

Stats & Numbers

Before/After Comparison Bar

Puts two numbers on one shared scale and calls out the delta — the proof-point shape for 'we cut your load time' or 'conversion rate before vs. after' case studies. Ships a screen-reader summary alongside the bars, so the comparison reads correctly even without the visual.

Subscription Included with the Velocity Components subscription.
bash
$ velocityx add before-after-bar

Built for astro.

Full docs for Before/After Comparison Bar →

Needs a licence key — subscribe here, then velocityx loginonce.

astro v1.0.2
Before/After Comparison Bar
Page load time

Before: 4.8s. After: 1.2s. Change: −3.6s (−75%). This is an improvement.

−3.6s (−75%) (improvement)

Props

NameTypeRequiredDefaultDescription
titlestringNo
beforeBarPointYes
afterBarPointYes
unitstringNo''Appended after the formatted number, e.g. "s", "%", "ms".
prefixstringNo''Prefixed before the formatted number, e.g. "$".
improvementIsDownbooleanNofalseSet when a lower "after" value is the win (load time, cost, churn).

File this creates

The CLI writes this path into your project, relative to its root — nothing else moves.

text
components/velocity/before-after-bar/BeforeAfterBar.astro

Using the Before/After Comparison Bar component

Install it with velocityx add before-after-bar. The CLI writes the source straight into your project — no runtime dependency, no registry lock-in, and it themes itself from the same primary-*/accent-* scale as the rest of the library.

More from Stats & Numbers.