Segmented bar
ProOne whole in a few parts, as a bar that prints its figures or a thin bar above a list of the parts; parts with an order can take the theme's ramp, lightest to darkest (the reverse in dark mode). Not an M3 component (@windmorph/react-pro).
import { SegmentedBar, SegmentedList } 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
SegmentedBar 15 props
The parts of the whole, in the app's order. Six at most (five
ordered); more fold into "Other".Formats an amount.
A pattern per part (a hatch; "Other" always has its dots), so no reader depends on hue (WCAG 1.4.1);
falseturns it off. Always on in forced colours.The parts have an order (ratings from 1 to 5, age bands): drawn in one hue, from the lightest step of the theme's ramp to the darkest (the reverse in dark mode), five at most; a pinned
slotdoesn't apply.Ref to the outermost element.
The outermost element's id.
Text
Names the whole. In a
ChartFrame, its title does unless this is given.The id of what names it.
The id of what describes it.
The id of what gives more about it.
Words it says. A
LabelsProvidersets them for the whole app.labels.describePlacetype(place: string, values: readonly ChartPlaceValue[], total: { label: string; value: string; } | undefined) => stringdefault"{place}: {label} {value}, {label} {value}. {total.label} {total.value}"What a place says to assistive technology as the keyboard reaches it: its name, then each series on show with its value, then the total where the series add up, with its word (
total).Before the sum in the readout and the description.
For a place a series has no value at, and what a chart with no places (or no parts) says from the keyboard.
Names the legend.
Said of the one series a legend still shows, whose chip can't hide it.
Names a segmented bar's key to its parts.
The part the parts past those drawn fold into (more than six, or five
ordered).labels.describeParttype(label: string, value: string, share: string, position: number, count: number) => stringdefault"{label}: {value}, {share}, {position} of {count}"A part, as the slider's value text says it: its name, amount and share, and where it is among the parts (
positionofcount).A funnel step's share of the one before.
In a table view, the column of a chart's places, unless the chart names it.
In a table view, the column of a whole's parts.
In a table view, the column of the parts' amounts.
What screen readers hear between a list row's name and its figures, never shown: a
SegmentedListrow's name, share and amount, aRankedBarsorFunnelBarsrow's name, amount and note, so they're read apart.
Classes for the outermost element. Wins over the defaults via
cn().Classes for each part.
The bar of parts. Spacing around it belongs on
stripBox, which the readout hangs from: a margin here moves the strip within that box, and the readout with the box's foot.The box holding the strip and its readout, which hangs 8px below the box's foot.
The strip and key together, a grid whose row below the strip (the key's) is at least the readout's gap and height: the readout hangs below the strip, over the key. In print, where there's no readout, that room goes.
Each part's block.
Each part's colour, the layer under its share that steps back while another is read.
The key below the bar: its list, which lays the parts out.
Each part's item in the key.
Each colour key in the key.
The readout.
The readout's part name, at its top.
The readout's line: the part's key, amount and share.
The readout's amount.
The readout's colour key.
The readout's share.
Inline styles for the outermost element.
Also accepts the root element's HTML attributes (id, data-*, event handlers).
SegmentedList 15 props
The parts of the whole, in the app's order. Six at most (five
ordered); more fold into "Other".Formats an amount.
A pattern per part on the bar and each row's key (a hatch; "Other" always has its dots), so no reader depends on hue (WCAG 1.4.1);
falseturns it off. Always on in forced colours.The parts have an order (ratings from 1 to 5, age bands): drawn in one hue, from the lightest step of the theme's ramp to the darkest (the reverse in dark mode), five at most; a pinned
slotdoesn't apply.Ref to the outermost element.
The outermost element's id.
Text
Names the list. In a
ChartFrame, its title does unless this is given.The id of what names it.
The id of what describes it.
The id of what gives more about it.
Words it says. A
LabelsProvidersets them for the whole app.labels.describePlacetype(place: string, values: readonly ChartPlaceValue[], total: { label: string; value: string; } | undefined) => stringdefault"{place}: {label} {value}, {label} {value}. {total.label} {total.value}"What a place says to assistive technology as the keyboard reaches it: its name, then each series on show with its value, then the total where the series add up, with its word (
total).Before the sum in the readout and the description.
For a place a series has no value at, and what a chart with no places (or no parts) says from the keyboard.
Names the legend.
Said of the one series a legend still shows, whose chip can't hide it.
Names a segmented bar's key to its parts.
The part the parts past those drawn fold into (more than six, or five
ordered).labels.describeParttype(label: string, value: string, share: string, position: number, count: number) => stringdefault"{label}: {value}, {share}, {position} of {count}"A part, as the slider's value text says it: its name, amount and share, and where it is among the parts (
positionofcount).A funnel step's share of the one before.
In a table view, the column of a chart's places, unless the chart names it.
In a table view, the column of a whole's parts.
In a table view, the column of the parts' amounts.
What screen readers hear between a list row's name and its figures, never shown: a
SegmentedListrow's name, share and amount, aRankedBarsorFunnelBarsrow's name, amount and note, so they're read apart.
Classes for the outermost element. Wins over the defaults via
cn().Classes for each part.
The thin bar of every part above the list.
Each part's block in the bar.
Each part's colour in the bar.
The list of parts.
Each row of it.
Each part's name.
Each part's amount.
Each row's colour key, with its part's pattern.
Inline styles for the outermost element.
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.
| Item | Status | Details |
|---|---|---|
A bar that prints its shares, with a key below (SegmentedBar) | Built | Variant · Parts |
A thin bar with the parts listed under it (SegmentedList) | Built | Variant · List, Ordered |
| More than six parts, folded into "Other" | Built | Configuration · Parts |
Ordered parts in the theme’s ramp (ordered) | Built | Configuration · Ordered |
A pattern per part, on by default (texture) | Built | Configuration · Parts, List |
Amounts in a unit of your own (formatValue) | Built | Configuration · List |
| Built on M3’s foundations, for charts | Extension | M3 has no charts. The parts take the charts’ colour slots, generated from the theme and checked at 3:1 on every surface, with figures in white or black at 4.5:1, M3’s corner shapes and the spatial spring. |
| Read by pointer, finger and keyboard | Extension | The bar is one stop, a native range input over its parts, so a phone’s screen reader steps it too; the pointer and a finger read the part under them in a readout. |
A bar that prints its shares, with a key below (
BuiltSegmentedBar)Variant · Parts
More than six parts, folded into "Other"
BuiltConfiguration · Parts
Ordered parts in the theme’s ramp (
Builtordered)Configuration · Ordered
Amounts in a unit of your own (
BuiltformatValue)Configuration · List
Built on M3’s foundations, for charts
ExtensionM3 has no charts. The parts take the charts’ colour slots, generated from the theme and checked at 3:1 on every surface, with figures in white or black at 4.5:1, M3’s corner shapes and the spatial spring.
Read by pointer, finger and keyboard
ExtensionThe bar is one stop, a native range input over its parts, so a phone’s screen reader steps it too; the pointer and a finger read the part under them in a readout.
Theming & tokens
Set the tokens below on the bar, the list or any ancestor. The parts' colours are the colour slots and ramp every chart shares (--wm-chart-color-1 to --wm-chart-color-8, --wm-chart-step-1 to --wm-chart-step-5 and --wm-chart-quiet for "Other"), and the readout is the core's rich tooltip, themed by its own --md-comp-rich-tooltip-* tokens. className goes on the root. Style each part with classNames: on a bar, strip, body, part, fill, share, legend, legendItem, legendKey, readout, readoutTitle, readoutRow, readoutValue, readoutKey, readoutName; on a list, strip, part, fill, list, row, key, name, share, figure.
| Variable | Default | Paints |
|---|---|---|
--wm-segmented-height | 28px | A segmented bar’s height, tall enough to print a share inside a part. |
--wm-segmented-list-height | 8px | A segmented list’s bar, which prints nothing. |
--wm-segmented-corner | var(--md-sys-shape-corner-extra-small) | Each part’s corners: every part is its own block. |
--wm-segmented-gap | 2px | The surface between parts. |
--wm-segmented-least-width | 4px | The least a part is across, so a sliver still shows. |
--wm-segmented-name-color | var(--md-sys-color-on-surface) | A part’s name in a segmented list. |
--wm-segmented-share-color | var(--md-sys-color-on-surface-variant) | A part’s share beside its name, quieter than the name and the amount. |
--wm-segmented-figure-color | var(--md-sys-color-on-surface) | A part’s amount after its share. |
--wm-segmented-list-column-gap | 12px | In a segmented list, the space between a row’s key, name, share and amount. |
--wm-segmented-list-row-gap | 8px | In a segmented list, the space between rows. |
--wm-segmented-grow-duration | var(--md-sys-motion-spring-spatial-default-duration) | How long the parts take to take their new shares. |
--wm-segmented-grow-easing | var(--md-sys-motion-spring-spatial-default-easing) | The easing of that change. |