Skip to content

progress_bar

A horizontal progress bar — health, mana, loading state, voting tally. Reads the current value from screen.data[value_key] and renders it as a fraction. The maximum can be a literal (max_value) or another data key (max_key); if both are set, max_key wins.

Display only.

C# factory

WidgetDefinitions.ProgressBar(
id: "health",
valueKey: "hp",
maxValue: 100,
positionX: 0.5f, positionY: 0.05f,
sizeW: 0.8f, sizeH: 0.04f,
color: "#ef4444",
label: "{hp}/100"
);

Wire format

FieldTypeRequiredNotes
idstringyes
type"progress_bar"yes
position_x, position_y, size_w, size_hnumberno0..1 anchor + size.
value_keystringyesData key for current value.
max_keystringnoData key for max. Wins over max_value if both are set.
max_valuenumbernoLiteral max. Used when max_key is absent.
colorstringnoFill color.
labelstringnoOptional caption above the bar. Supports {key} bindings.

Events

Display only.

Example

// Push HP changes — the bar animates on every connected phone.
manager.UpdateScreenDataForAll("game", new { hp = currentHp });