Components Feedback
Spinner
Indicate a running task when its completion percentage is unknown.
Preparing the proof…
Usage
Supply Label with the operation in progress. Replace the status when the task completes. The visible text continues to communicate loading when motion is reduced.
Register spinner with Head and pass its properties to Render. Go setup guide
Go usage
err := mono.UI.Render(w, "spinner", mono.Props{
"Label": "Preparing the proof…",
})Rendered HTML
<span data-mono="spinner" id="demo-spinner" role="status" class="mu-row">
<span aria-hidden="true" class="mu-spinner-disc"></span><span class="mu-small">Preparing the proof…</span>
</span>Go template
<span data-mono="spinner" id="{{.ID}}" role="status" class="mu-row">
<span aria-hidden="true" class="mu-spinner-disc"></span><span class="mu-small">{{.Label}}</span>
</span>Component CSS
[data-mono="spinner"] .mu-spinner-disc { width:1rem; height:1rem; flex:none; border:2px solid #c8c8c8; border-top-color:#171717; border-radius:50%; }
@media (prefers-reduced-motion:no-preference) {
[data-mono="spinner"] .mu-spinner-disc { animation:mu-spinner-turn .8s linear infinite; }
@keyframes mu-spinner-turn { to { transform:rotate(1turn); } }
}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.
<link rel="stylesheet" href="./base.css">
<link rel="stylesheet" href="./spinner.css">Copy into your project
Run this command from the Mono checkout. Set -out to the component directory in your application.
go run ./cmd/mono-ui add -out ./components spinnerExample properties (JSON)
{
"Label": "Preparing the proof…"
}