Spinner
spinner · Elements
A circle that turns while something is happening.
Import
cpp
#include "gbui/widgets/spinner.hpp"Example
cpp
NodeId spinner(Ui& ui, const SpinnerOptions& options = {});A turning ring.
API
SpinnerOptions
| Option | Type | Default | What it does |
|---|---|---|---|
size | float | 16.0f | |
thickness | float | 0.0f | How thick the ring is. Zero takes a sixth of size, which keeps a large spinner from looking like a hairline and a small one from looking like a doughnut. |
color | Token | Token::Accent | |
track | Token | Token::Border | The part of the ring that is not the moving arc, behind it. |
name | std::string_view | What is happening — "Cloning", "Signing in". Announced as a live region, because a spinner is the one control whose whole meaning is invisible to a reader who cannot see it turning. Empty says nothing at all, which is right when the surrounding text already says it or when a busy state on the container does. | |
phase | float | 0.0f | Where in its turn it is, in turns. Feed it a clock. The caller's, exactly as progressBar's indeterminate form takes it, and for the same reason: a component here holds no state, and "how long has this been spinning" is state. One turn per second is time; half that speed is time * 0.5f. The fractional part is all that is read, so a clock that never resets is fine. |