Progress

The progress component draws a thin bar that is filled in proportion to a number. The Designer calls it Progress. Use it for something that advances, such as a download, a build or a sync, and update the banner by sending the same notification id again with a new value.

Minimal exampleJSON
{"type":"progress","binding":"{percent}"}

Realistic example

A title that includes the percentage, and a thicker green bar under it. The bar collapses when the notification sends no value.

JSON
{"name":"progress-demo","app":"example.bidbot","layoutVersion":2,"collapseEmpty":true,
 "grid":{"rows":2,"cols":1,"rowSizes":["auto","auto"],"colSizes":["fill"],"gap":6,"padding":12,"width":380},
 "cells":[
  {"id":"title","row":0,"col":0,"component":{"type":"text","binding":"{title} {percent}%","style":"title"}},
  {"id":"bar","row":1,"col":0,
   "component":{"type":"progress","binding":"{percent}","color":"#34C759","height":6,"emptyBehavior":"collapse"}}]}
A banner whose template has a progress cell. The bar is filled to 62 percent.
A banner with a bar filled to about two thirds under the body text

A banner whose template has a progress cell. The bar is filled to 62 percent.

Properties

PropertyTypeDefaultDescription
typestringrequiredAlways "progress".
bindingstringrequiredThe value, usually one numeric field such as "{percent}".
colorstringaccentThe colour of the filled part: a hex colour, or accent, primary or secondary. A hex colour is adjusted until it is legible on the current appearance.
heightnumber4The thickness of the bar in points. It must be above 0, and the bar is at least 1 point thick.
emptyBehaviorstringtemplate defaultcollapse or keep. See Empty bars.

How the value is read#

The bound text is read as a number and turned into a fraction between 0 and 1:

  • A number up to 1 is already a fraction.
  • A number above 1, or text ending in %, is a percentage.
  • The result is clamped to 0 through 1.
ValueBar filled to
0.2525 percent
1100 percent, because 1 is a fraction
1.51.5 percent, because a value above 1 is a percentage
4040 percent
"40%"40 percent
250100 percent, because it is clamped

If the value is present but is not a number, such as "3 of 7", the bar is not drawn and its space is kept.

Sizing and alignment#

The bar fills the width of its cell, at least 40 points, and is exactly height points thick. In an auto column its ideal width is 120 points. It is drawn as a rounded track with a faint tint of the primary colour behind the filled part, so it follows the light or dark appearance. When the row is taller than the bar, the cell's align places it vertically.

A progress bar has no action.

Empty bars#

A bar is empty when every token in its binding is absent or blank. A kept empty bar is invisible and holds its height.

Common mistakes#

MistakeWhat happensFix
Sending 1 to mean 1 percent.The bar shows 100 percent.Send 0.01 or "1%".
Binding a field that holds "3 of 7".It is not a number, so the bar is not drawn.Send a fraction or a percentage.
A progress bar in an auto column.The column is only about 120 points wide.Put the bar in a fill column, or span several columns.

Edit this page on GitHub

Esc
Getting started
Guides