Community project. This is not an official government website.

Run by volunteers. Lampung Design System is built by an open source community. No government agency runs or endorses it.

Official services use go.id. Government websites in Indonesia end in .go.id. Never enter your national ID number on a site you are unsure of.

Ranked bars

Ranked bars

Rows of a label, a horizontal bar and its value, sorted longest first: top sources, top pages, best scores. Long labels stay readable because they sit beside (or inside) the bar instead of under it, and every row shares one grid so bars and values line up.

Usage

Use it when

  • Ranking 3 to 10 named things by one value: traffic sources, pages, products, students, regions.
  • Category names are long or many ("Partner schools", "/courses/sql-basics"), which vertical bars would have to rotate.
  • A leaderboard: rank, who, and the score, with the bar as a quick sense of the gaps.

Use something else when

  • Categories that have an order of their own (weekdays, months): use Bar chart.
  • Progress of each item toward its own goal: use Target bar.
  • Parts that add up to one whole: use Percentage bar.
  • Many records compared on several attributes: use Table.
  • Steps of a flow where each keeps a share of the one before: use Funnel.

Where it goes. In a chart card, half width on a dashboard. Under 480 px the bar moves under its label and value, full width. Set --label-w on .hbars to change the label column (default 140 px).

Examples

Top sources with their changeIcon, name, bar, visits and the change against last month. Point at a row to bring it forward. Bars grow in on first view.
Where do visitors come from?
Visits by source, November
Search4,21012% up
Newsletter2,3804% up
Partner schools1,7106% down
Social posts96021% up
Direct6402% down
<section class="chart-card" style="max-width: 560px;" aria-labelledby="rb-src">
  <div><div class="chart-card__q" id="rb-src">Where do visitors come from?</div><div class="chart-card__sub">Visits by source, November</div></div>
  <div class="hbars" role="list" data-lds-grow aria-label="Visits by source">
  <div role="listitem" class="hbar is-top"><span class="hbar__label"><span class="hbar__media" aria-hidden="true"><span class="ic">search</span></span><span>Search</span></span><span class="hbar__track"><span class="hbar__fill" style="--v: 100.0%;"></span></span><span class="hbar__val">4,210<span class="delta delta--good"><span class="ic" aria-hidden="true">arrow_upward</span>12%<span class="sr-only"> up</span></span></span></div>
  <div role="listitem" class="hbar"><span class="hbar__label"><span class="hbar__media" aria-hidden="true"><span class="ic">mail</span></span><span>Newsletter</span></span><span class="hbar__track"><span class="hbar__fill" style="--v: 56.5%;"></span></span><span class="hbar__val">2,380<span class="delta delta--good"><span class="ic" aria-hidden="true">arrow_upward</span>4%<span class="sr-only"> up</span></span></span></div>
  <div role="listitem" class="hbar"><span class="hbar__label"><span class="hbar__media" aria-hidden="true"><span class="ic">school</span></span><span>Partner schools</span></span><span class="hbar__track"><span class="hbar__fill" style="--v: 40.6%;"></span></span><span class="hbar__val">1,710<span class="delta delta--bad delta--down"><span class="ic" aria-hidden="true">arrow_upward</span>6%<span class="sr-only"> down</span></span></span></div>
  <div role="listitem" class="hbar"><span class="hbar__label"><span class="hbar__media" aria-hidden="true"><span class="ic">share</span></span><span>Social posts</span></span><span class="hbar__track"><span class="hbar__fill" style="--v: 22.8%;"></span></span><span class="hbar__val">960<span class="delta delta--good"><span class="ic" aria-hidden="true">arrow_upward</span>21%<span class="sr-only"> up</span></span></span></div>
  <div role="listitem" class="hbar"><span class="hbar__label"><span class="hbar__media" aria-hidden="true"><span class="ic">link</span></span><span>Direct</span></span><span class="hbar__track"><span class="hbar__fill" style="--v: 15.2%;"></span></span><span class="hbar__val">640<span class="delta delta--bad delta--down"><span class="ic" aria-hidden="true">arrow_upward</span>2%<span class="sr-only"> down</span></span></span></div>
  </div>
</section>
LeaderboardRank, avatar and course under the name; one quiet color so the gaps carry the story.
Who scored highest this term?
Final scores out of 100, top five
1Nadia PutriDatabase Systems96
2Rizky HartonoStatistics91
3Mei Lin TanDatabase Systems88
4Dimas SaputraAcademic writing84
5Ayu LestariStatistics79
<section class="chart-card" style="max-width: 560px;" aria-labelledby="rb-lead">
  <div><div class="chart-card__q" id="rb-lead">Who scored highest this term?</div><div class="chart-card__sub">Final scores out of 100, top five</div></div>
  <div class="hbars" role="list" data-lds-grow style="--label-w: 220px;" aria-label="Top five scores">
  <div role="listitem" class="hbar"><span class="hbar__label"><span class="hbar__rank">1</span><span class="avatar avatar--gray hbar__media" aria-hidden="true">NP</span><span><span>Nadia Putri</span><span class="hbar__sub">Database Systems</span></span></span><span class="hbar__track"><span class="hbar__fill" style="--v: 96%;"></span></span><span class="hbar__val">96</span></div>
  <div role="listitem" class="hbar"><span class="hbar__label"><span class="hbar__rank">2</span><span class="avatar avatar--gray hbar__media" aria-hidden="true">RH</span><span><span>Rizky Hartono</span><span class="hbar__sub">Statistics</span></span></span><span class="hbar__track"><span class="hbar__fill" style="--v: 91%;"></span></span><span class="hbar__val">91</span></div>
  <div role="listitem" class="hbar"><span class="hbar__label"><span class="hbar__rank">3</span><span class="avatar avatar--gray hbar__media" aria-hidden="true">ML</span><span><span>Mei Lin Tan</span><span class="hbar__sub">Database Systems</span></span></span><span class="hbar__track"><span class="hbar__fill" style="--v: 88%;"></span></span><span class="hbar__val">88</span></div>
  <div role="listitem" class="hbar"><span class="hbar__label"><span class="hbar__rank">4</span><span class="avatar avatar--gray hbar__media" aria-hidden="true">DS</span><span><span>Dimas Saputra</span><span class="hbar__sub">Academic writing</span></span></span><span class="hbar__track"><span class="hbar__fill" style="--v: 84%;"></span></span><span class="hbar__val">84</span></div>
  <div role="listitem" class="hbar"><span class="hbar__label"><span class="hbar__rank">5</span><span class="avatar avatar--gray hbar__media" aria-hidden="true">AL</span><span><span>Ayu Lestari</span><span class="hbar__sub">Statistics</span></span></span><span class="hbar__track"><span class="hbar__fill" style="--v: 79%;"></span></span><span class="hbar__val">79</span></div>
  </div>
</section>
Labels inside, switching the periodLong paths fit inside tint bars. Switch the period: bars move to their new lengths over 480 ms.
Which pages get read?
Views per page
/courses/sql-basics3,120
/pricing2,210
/courses/statistics1,640
/blog/study-plan980
/about410
<div class="hbars hbars--inside" role="list" aria-label="Views per page">
  <div role="listitem" class="hbar is-top"><span class="hbar__track"><span class="hbar__fill" style="--v: 100%;"></span><span class="hbar__label">/courses/sql-basics</span></span><span class="hbar__val">3,120</span></div>
  …
</div>

Anatomy

PartWhat it is
.hbarsRequired. The grid: label column, bar column, value column. role="list" when the rows are a ranking.
.hbarRequired. One row; a subgrid of .hbars, so values line up across rows. .is-top marks the leader.
.hbar__labelRequired. The name; may start with .hbar__rank, .hbar__media (an icon tile or .avatar) and carry a .hbar__sub line.
.hbar__track > .hbar__fillRequired. 10 px track; --v sets the fill as a percent of the largest value.
.hbar__valRequired. The value, tabular; may hold a trend delta.
.hbars--insideVariant. 36 px tint bars with the label inside, for long labels in narrow cards.
.hbars--mutedVariant. Every bar but .is-top recedes to the tint.

Variants and sizes

Class or attributeWhen
.hbar__mediaAn icon tile (sources, products) or an .avatar (people) before the name.
.hbar__rankPosition number for leaderboards.
.hbar__subA second line under the name: course, category, visits.
.hbars--insideLabel inside a 36 px tint bar; the leader gets a 3 px accent edge.
.hbars--mutedOnly the leader in the series color.
--label-wWidth of the label column on .hbars.

States

StateHow
hoverThe row under the pointer stays, the others fade to 55 %.
data changeSet new --v values: fills move over 480 ms on --ease-inout. Re-sort only after the move, or not at all while someone reads.
loadingFive .skel rows: a label block and a 10 px strip.
emptyKeep the title; one line saying no visits came in for the period.

Motion and microinteractions

  • First view (data-lds-grow): fills grow from zero on --spring-smooth (560 ms), 35 ms apart from the top row.
  • Value changes: width over --d-considered on --ease-inout, from the current width.
  • Hover fade over --d-fast. Reduced motion: values switch in 120 ms, no stagger.

Accessibility

  • Use role="list" on .hbars and role="listitem" on rows when the order is the point; the label and value are real text, so the list reads "Search, 4,210, 12% up".
  • The bar is decoration on top of the value; no extra label is needed.
  • A delta carries "up" or "down" in .sr-only text.

Do and don't

Do

  • Sort longest first; say the period in the subtitle.
  • Scale every bar to the largest value in the set, or to a fixed maximum such as 100 for scores.

Don't

  • Give every bar its own color.
  • Cut the bar axis above zero.
  • Show more than ten rows; add a link to the full table instead.

Behavior and code

Plain HTML. Optional: data-lds-grow on .hbars (or its card) plays the first-view entrance. Values change by setting --v on each fill.