CompositionBar
Stacked-Bar mit Legend zur Visualisierung von Aggregat-Kompositionen.
Playground
| Share | Value | Percent |
|---|---|---|
| Anteil A | 60 | 60.0 % |
| Anteil B | 30 | 30.0 % |
| Anteil C | 10 | 10.0 % |
Loading...
Loading syntax highlighting...01 Examples
Heating Cost Pot
Stacked bar as a cost-pot composition: gas + heat pump electricity + maintenance + chimney sweep add up to the heating cost pot of a service charge statement.
Heating cost pot 2024 3.822,42 €
| Share | Value | Percent |
|---|---|---|
| Gas bill | 2.206,09 € | 57.7 % |
| Heat pump electricity | 1.127,31 € | 29.5 % |
| Heating system maintenance | 361,02 € | 9.4 % |
| Chimney sweep levy | 128,00 € | 3.3 % |
Loading...
Loading syntax highlighting...Sizes
Three height steps for different levels of hierarchy.
| Share | Value | Percent |
|---|---|---|
| Rent | 1.450,00 € | 54.7 % |
| Groceries | 480,00 € | 18.1 % |
| Electricity & gas | 220,00 € | 8.3 % |
| Mobility | 180,00 € | 6.8 % |
| Savings | 320,00 € | 12.1 % |
| Share | Value | Percent |
|---|---|---|
| Rent | 1.450,00 € | 54.7 % |
| Groceries | 480,00 € | 18.1 % |
| Electricity & gas | 220,00 € | 8.3 % |
| Mobility | 180,00 € | 6.8 % |
| Savings | 320,00 € | 12.1 % |
| Share | Value | Percent |
|---|---|---|
| Rent | 1.450,00 € | 54.7 % |
| Groceries | 480,00 € | 18.1 % |
| Electricity & gas | 220,00 € | 8.3 % |
| Mobility | 180,00 € | 6.8 % |
| Savings | 320,00 € | 12.1 % |
Loading...
Loading syntax highlighting...Legend Placement
Four anchor positions for the legend (top, right, bottom, left).
Top 2.650,00 €
| Share | Value | Percent |
|---|---|---|
| Rent | 1.450,00 € | 54.7 % |
| Groceries | 480,00 € | 18.1 % |
| Electricity & gas | 220,00 € | 8.3 % |
| Mobility | 180,00 € | 6.8 % |
| Savings | 320,00 € | 12.1 % |
Right 2.650,00 €
| Share | Value | Percent |
|---|---|---|
| Rent | 1.450,00 € | 54.7 % |
| Groceries | 480,00 € | 18.1 % |
| Electricity & gas | 220,00 € | 8.3 % |
| Mobility | 180,00 € | 6.8 % |
| Savings | 320,00 € | 12.1 % |
Bottom 2.650,00 €
| Share | Value | Percent |
|---|---|---|
| Rent | 1.450,00 € | 54.7 % |
| Groceries | 480,00 € | 18.1 % |
| Electricity & gas | 220,00 € | 8.3 % |
| Mobility | 180,00 € | 6.8 % |
| Savings | 320,00 € | 12.1 % |
Left 2.650,00 €
| Share | Value | Percent |
|---|---|---|
| Rent | 1.450,00 € | 54.7 % |
| Groceries | 480,00 € | 18.1 % |
| Electricity & gas | 220,00 € | 8.3 % |
| Mobility | 180,00 € | 6.8 % |
| Savings | 320,00 € | 12.1 % |
Loading...
Loading syntax highlighting...Vertical Orientation
Stacked column for vertical layouts (e.g. sidebar visualizations).
| Share | Value | Percent |
|---|---|---|
| Gas bill | 2.206,09 € | 57.7 % |
| Heat pump electricity | 1.127,31 € | 29.5 % |
| Heating system maintenance | 361,02 € | 9.4 % |
| Chimney sweep levy | 128,00 € | 3.3 % |
Loading...
Loading syntax highlighting...Tiny Segments
Very small segments are raised to a minimum width so hover and tooltip still work on them.
| Share | Value | Percent |
|---|---|---|
| Main share | 950 | 98.3 % |
| Mini A | 8 | 0.8 % |
| Mini B | 3 | 0.3 % |
| Mini C | 5 | 0.5 % |
Loading...
Loading syntax highlighting...Total Override (Remainder)
If the explicit total exceeds Σ items.value, the unaccounted share is rendered as a dashed remainder area.
Expected 5.000,00 € 5.000,00 €
| Share | Value | Percent |
|---|---|---|
| Gas bill | 2.206,09 € | 44.1 % |
| Heat pump electricity | 1.127,31 € | 22.5 % |
| Heating system maintenance | 361,02 € | 7.2 % |
| Chimney sweep levy | 128,00 € | 2.6 % |
| Expected 5.000,00 € (remaining) | 1.177,58 € | 23.6 % |
Loading...
Loading syntax highlighting...Raw Color Overrides
Per-item color prop for brand-specific palettes (e.g. token allocations).
| Share | Value | Percent |
|---|---|---|
| Treasury | 40 % | 40 % |
| Liquidity | 30 % | 30 % |
| Team | 15 % | 15 % |
| Community | 15 % | 15 % |
Loading...
Loading syntax highlighting...02 Customization
Custom Tooltip Snippet
Custom tooltip content with additional metadata via the tooltip snippet.
| Share | Value | Percent |
|---|---|---|
| Gas bill | 2.206,09 € | 57.7 % |
| Heat pump electricity | 1.127,31 € | 29.5 % |
| Heating system maintenance | 361,02 € | 9.4 % |
| Chimney sweep levy | 128,00 € | 3.3 % |
Loading...
Loading syntax highlighting...Compact Card Embedding
Embedded in a card with a header at the sm size.
Treasury Allocation
Q1 2026| Share | Value | Percent |
|---|---|---|
| Treasury | 40 % | 40 % |
| Liquidity | 30 % | 30 % |
| Team | 15 % | 15 % |
| Community | 15 % | 15 % |
Loading...
Loading syntax highlighting...03 Accessibility
ARIA Image Role + Summary
The bar container has role="img" with a combined aria-label summary (total plus each share with value
and percent), so screen readers can grasp the bar as a whole.
Table Fallback
An sr-only table duplicates the data in tabular form (share / value / percent) for screen readers that prefer tables over images.
Keyboard Navigation
Tab focuses the next segment, Arrow keys move between segments, Home /End jump to the first/last, Enter/Space triggers onItemSelect.
Bidirectional Highlight
Hovering or focusing a bar segment dims all other segments AND highlights the matching
legend entry (and vice versa) — the link runs through the shared item.id (fallback: index).
04 API Reference
24 props 1 required
Add filter
Grouping
Summary
Column visibility
No matching properties |
No matching properties
05 Installation
Import
Loading...
Loading syntax highlighting...