Velocity X Components

Stats & Numbers

Horizontal Bar Ranking

A ranked top-N list — top pages, top referrers, top SKUs — where bar length shows magnitude and every label and value stays fully legible outside the fill, never clipped or reversed on dark mode. Auto-sorts descending, prints the rank number on every row, and ships an exact-value table fallback for anyone who can't read the bars visually.

Subscription Included with the Velocity Components subscription.
bash
$ velocityx add horizontal-bar-ranking

Built for astro.

Full docs for Horizontal Bar Ranking →

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

astro v1.0.1
Horizontal Bar Ranking

Top referrers

  1. Rank 1: google.com 18,420
  2. Rank 2: Direct 9,310
  3. Rank 3: twitter.com 4,120
  4. Rank 4: newsletter 2,860
  5. Rank 5: reddit.com 1,140
Top referrers — exact values
RankLabelValue
1 google.com 18,420
2 Direct 9,310
3 twitter.com 4,120
4 newsletter 2,860
5 reddit.com 1,140

Props

NameTypeRequiredDefaultDescription
titlestringNo'Top referrers'
rowsRankingRow[]No[ { label: 'google.com', value: 18420 }, { label: 'Direct', value: 9310 }, { label: 'twitter.com', value: 4120 }, { label: 'newsletter', value: 2860 }, { label: 'reddit.com', value: 1140 }, ]
preserveOrderbooleanNofalseSkip the built-in descending sort — caller has already ordered rows.
limitnumberNoCap the number of rows rendered.
classNamestringNo''

File this creates

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

text
components/velocity/horizontal-bar-ranking/HorizontalBarRanking.astro

Using the Horizontal Bar Ranking component

Install it with velocityx add horizontal-bar-ranking. 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.