Components Feedback

Progress

Expose the completed portion of a task with native progress semantics.

Live previewGo + HTML
7 of 10 proofs
7 / 10

Usage

Set Value and Max in matching units. Add Detail to display readable units. The native progress element exposes its value to assistive technology.

Register progress with Head and pass its properties to Render. Go setup guide

Go usage
Go usage
err := mono.UI.Render(w, "progress", mono.Props{
	"Detail": "7 of 10 proofs",
	"Label":  "Proofs reviewed",
	"Max":    10,
	"Value":  7,
})
Rendered HTML
Rendered HTML
<div data-mono="progress" id="demo-progress" class="mu-stack">
  <div class="mu-row"><label class="mu-label" for="demo-progress-meter">Proofs reviewed</label><span class="mu-muted mu-small">7 of 10 proofs</span></div>
  <progress id="demo-progress-meter" value="7" max="10">7 / 10</progress>
</div>
Go template
Go template
<div data-mono="progress" id="{{.ID}}" class="mu-stack">
  <div class="mu-row"><label class="mu-label" for="{{.ID}}-meter">{{.Label}}</label>{{with .Detail}}<span class="mu-muted mu-small">{{.}}</span>{{end}}</div>
  <progress id="{{.ID}}-meter" value="{{.Value}}" max="{{.Max}}">{{.Value}} / {{.Max}}</progress>
</div>
Component CSS
Component CSS
[data-mono="progress"] { width:100%; max-width:24rem; }
[data-mono="progress"] .mu-row { justify-content:space-between; }
[data-mono="progress"] progress { display:block; width:100%; height:.65rem; overflow:hidden; border:0; border-radius:1rem; appearance:none; background:#e3e3e3; color:#181818; accent-color:#181818; }
[data-mono="progress"] progress::-webkit-progress-bar { background:#e3e3e3; }
[data-mono="progress"] progress::-webkit-progress-value { background:#181818; border-radius:1rem; }
[data-mono="progress"] progress::-moz-progress-bar { background:#181818; border-radius:1rem; }
Use the HTML in a static site

Copy the rendered HTML above. Download these assets into the same folder as your page, then add the tags below to its head.

Shared CSS Component CSS

HTML head
<link rel="stylesheet" href="./base.css">
<link rel="stylesheet" href="./progress.css">

Copy into your project

Run this command from the Mono checkout. Set -out to the component directory in your application.

Terminal
go run ./cmd/mono-ui add -out ./components progress
Example properties (JSON)
example.json
{
  "Detail": "7 of 10 proofs",
  "Label": "Proofs reviewed",
  "Max": 10,
  "Value": 7
}