Pathfinderby Commenda
Components

Distribution bar

Parts of a whole with exact numeric shares and grouped breakdowns.

Ownership distribution
    • Elena Petrova: 6 (6%)
    • Aleksandra Wiśniewska-Kowalczyk: 3 (3%)
    • Jo: 2 (2%)

Import from @commenda/pathfinder/distribution-bar and load the shared stylesheet once.

API reference

PropTypeBehavior
labelRequiredstringAccessible figure caption
segmentsRequiredreadonly DistributionSegment[]{ id, label, value, color }; IDs must be unique
totalnumberSum when omitted; explicit totals support remaining allocation
size"sm"|"md"6px / 8px; defaults to md
legend"inline"|"list"|"none"Inline by default; none retains an accessible breakdown
formatValue( value: number ) => stringNumeric formatting for values
highlightConfigObjectView fieldsOptional controlled highlighting for a linked table
classNamestringRoot styling
highlightConfigObject fields
FieldTypeRequirement
activeIdstring | nullRequired
onActiveChange(id: string | null) => voidRequired

color accepts 1 through 6, other, and semantic success / warning / error / info / neutral. Assign it by identity before sorting so the same holder keeps the same color. Categorical colors come from Figma's data palette; red belongs to status breakdowns.

List legend

Ownership distribution
    • Elena Petrova: 6 shares (6%)
    • Aleksandra Wiśniewska-Kowalczyk: 3 shares (3%)
    • Jo: 2 shares (2%)

The largest parts appear first. Above six items, the largest five remain individual and the rest form Other. Every source member remains in the accessible breakdown and Other tooltip. Hovering a segment or focusing a legend entry highlights its group. A linked table can supply a source member ID to highlight Other when that member is grouped. The generated Other ID starts at __other__, adding leading underscores if needed to avoid collisions.

Remaining allocation

Capacity

Unallocated: 62 (62%)

The unused total remains as track. A visual 4px minimum helps tiny positive parts remain visible; numeric shares are authoritative. Zero-valued entries remain in the legend but have no painted segment.

Over-allocation

Ownership allocation
    • Elena Petrova: 6 (7.5%)
    • Aleksandra Wiśniewska-Kowalczyk: 3 (3.75%)
    • Jo: 2 (2.5%)

When the sum exceeds the total, the bar scales to the sum and a persistent Alert explains the original percentage. Negative, non-finite, duplicate-ID, and invalid-total inputs produce an error rather than misleading geometry. Empty/zero allocations show an empty track. This is a figure with a data breakdown, not an ARIA progressbar.

Read the record component rules.

Design rules

Figma guidance and reviewed implementation decisions for this component. Rule IDs remain stable for source comments and AI references.

Source rules

RuleContract and provenance
DISTRIBUTION-001Figma 876:59943 / 883:100: 6/8px track, 2px gaps, identity-stable data colors.
DISTRIBUTION-002Six visible groups maximum, five plus Other when necessary; source members remain available.
DISTRIBUTION-003Unallocated remainder stays track. Over-allocation scales geometry and explains the original percentage.
DISTRIBUTION-004Visual minimum 4px is not numeric precision. Keep exact shares and a textual breakdown, including with legend=none.

Recorded design decisions

The Figma distribution instance paints six categories plus Other, while its documentation says at most six parts. The approved implementation plan uses six total (five plus Other when grouping). Tiny segments use constrained minimum widths, so the legend and tooltip supply exact data. Supporting text uses soft-pearl 800 where lighter Figma text would miss contrast requirements.

On this page