Bar List

A top-N ranking: a label over a bar scaled to the biggest value, the formatted value and its share of the total. Sorted from the biggest value, rendered on the server and themed by the design tokens.

Part of @tectra-ng/charts (npm install @tectra-ng/charts, also included in tectra-ng).

Features7APIThemingAccessibility

Basic

Pass items with a label and a value in any order. The list sorts them, scales each bar to the biggest value and shows the percent of the total; zero values are left out.

  • Germany4,28033.2%
  • France3,12024.2%
  • Spain2,31017.9%
  • Poland1,94015%
  • Italy1,2609.8%

Limit

limit keeps only the biggest rows (10 by default). The percent is still the share of the whole total, so the visible rows may add up to less than 100%.

  • Chrome5,21051.1%
  • Safari2,38023.3%
  • Firefox9409.2%

Value format

valueFormat formats the values: number (default), integer, compact (12.4K), percent or your own function. Numbers follow the tectra locale.

  • Organic128.4K54.1%
  • Paid64.3K27.1%
  • Social31.8K13.4%
  • Email12.9K5.4%
  • Team$48,20051%
  • Pro$36,95039.1%
  • Starter$9,4009.9%

Loading and empty

loading shows skeleton rows; a list with no positive values says "No data" in the tectra locale.

No data

Design tokens

dt sets the tokens of one list — the barList group of the chart tokens: row height, gaps, bar colour and radius, text colours.

  • English6,40057%
  • Spanish2,10018.7%
  • German1,75015.6%
  • Japanese9808.7%

Pass through

pt adds classes and styles to the parts: root, list, item, row, track, bar, label, value, percent, empty, skeleton.

  • Desktop5,82055.1%
  • Mobile4,13039.1%
  • Tablet6105.8%