Skip to content

Ranked bars

Pro

Parts compared on one scale, largest first, with the rest in one row last; and a funnel's steps with each one's share of the step before. Not an M3 component (@windmorph/react-pro).

import { RankedBars, FunnelBars } from '@windmorph/react-pro/charts';

Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.

Props

By name or description, across the 26 props below

RankedBars 13 props

  • rowstype readonly RankedBarsRow[]Required

    The parts to compare, each key once; ranked largest first unless sort is none.

  • sorttype "descending" | "none"default "descending"

    descending puts the largest first; none keeps the app's order.

  • formatValuetype ChartFormatterdefault Intl.NumberFormat in the page's locale

    Formats an amount.

  • reftype Ref<HTMLDivElement>

    Ref to the outermost element.

  • idtype string

    The outermost element's id.

Text

  • labelstype Partial<ChartLabels>

    Words it shows ("No value" for an amount that isn't a number). A LabelsProvider sets them for the whole app.

  • aria-labeltype string

    Names the list. In a ChartFrame, its title does unless this is given.

  • aria-labelledbytype string

    The id of what names it.

  • aria-describedbytype string

    The id of what describes it.

  • aria-detailstype string

    The id of what gives more about it.

Also accepts the root element's HTML attributes (id, data-*, event handlers).

FunnelBars 13 props

  • stepstype readonly FunnelStep[]Required

    The steps, in the order people take them; never ranked.

  • formatValuetype ChartFormatterdefault Intl.NumberFormat in the page's locale

    Formats an amount.

  • formatSharetype ChartFormatterdefault a whole percentage

    Formats a step's share of the one before, 0 to 1.

  • reftype Ref<HTMLDivElement>

    Ref to the outermost element.

  • idtype string

    The outermost element's id.

Text

  • labelstype Partial<ChartLabels>

    Words it says. A LabelsProvider sets them for the whole app.

  • aria-labeltype string

    Names the list. In a ChartFrame, its title does unless this is given.

  • aria-labelledbytype string

    The id of what names it.

  • aria-describedbytype string

    The id of what describes it.

  • aria-detailstype string

    The id of what gives more about it.

Also accepts the root element's HTML attributes (id, data-*, event handlers).

Spec status

Not part of Material Design 3: a Windmorph Pro component, built on M3's colour roles, type scale, shapes and motion. Its variants and configurations each link to a live example.

  • Largest first, with the rest last (RankedBars, rest)

    Built

    Variant · Cities

  • Steps with each one’s share of the step before (FunnelBars)

    Built

    Variant · Funnel

  • A narrow container: names on a line of their own

    Built

    Configuration · Narrow

  • Built on M3’s foundations, for charts

    Extension

    M3 has no charts. The bars take the charts’ first colour slot, built from the theme’s primary, with the rest row in the quiet colour, M3’s type scale for names and amounts, and the spatial spring.

Theming & tokens

Set the tokens below on the list or any ancestor; both components share them. The bars' colour is the charts' first slot, --wm-chart-color-1, and the rest row's is --wm-chart-quiet. className goes on the root. Style each part with classNames: list, row, name, track, bar, figure, and on a funnel also note, each step's share of the one before.

RankedBars and FunnelBars tokens
VariableDefaultPaints
--wm-bar-list-thickness12pxEach bar’s thickness.
--wm-bar-list-cornervar(--md-sys-shape-corner-extra-small)A bar’s data end; its start stays square on the baseline.
--wm-bar-list-row-gap12pxThe space between rows.
--wm-bar-list-column-gap12pxThe space between the names, the bars and the amounts.
--wm-bar-list-line-gap4pxThe space between a row’s lines: its bar under its name in a narrow list, a funnel step’s share under its bar.
--wm-bar-list-name-width14remThe most the names’ column takes before the bars.
--wm-bar-list-name-colorvar(--md-sys-color-on-surface)Each row’s name.
--wm-bar-list-figure-colorvar(--md-sys-color-on-surface)Each row’s amount.
--wm-bar-list-grow-durationvar(--md-sys-motion-spring-spatial-default-duration)How long a bar takes to grow to a new amount, one row after another as the list is first seen.
--wm-bar-list-grow-easingvar(--md-sys-motion-spring-spatial-default-easing)The easing of that change.
--wm-bar-list-note-colorvar(--md-sys-color-on-surface-variant)A funnel step’s share of the one before.