Widgets / ProgressBar · Spinner · Toggle

ProgressBar · Spinner · Toggle

A fill bar, an animated braille spinner, and checkbox/radio/switch glyphs.

Toggle · ProgressBar · Spinner[x] done [ ] todo ON OFF ███████░░░░░░░░░░░░░░░░░░░░░█████████████████░░░░░░░░░░░████████████████████████████⠋ working…

Signature

ProgressBar.view (width: int) (fillStyle: Style) (trackStyle: Style) (fraction: float) : LayoutNode<'msg>
Spinner.labeled (spinStyle: Style) (labelStyle: Style) (tick: int) (label: string) : LayoutNode<'msg>
Toggle.checkbox (style: Style) (isChecked: bool) (label: string) : LayoutNode<'msg>
Toggle.switch (onStyle: Style) (offStyle: Style) (isOn: bool) : LayoutNode<'msg>

Parameters

parameter type what it is
fraction float ProgressBar fill, 0.0–1.0 (clamped).
tick int Spinner frame index — advance it from a Sub.Every counter.
isOn / isChecked bool Toggle state (switch / checkbox; Toggle.radio is the same shape).

Notes

All are pure functions of state you hold. To animate the spinner, increment a tick on a Sub.Every and pass it in. Toggle ships checkbox, radio, and switch.

Example

// subscriptions: tick four times a second while busy
[ Sub.Every(TimeSpan.FromMilliseconds 250.0, fun () -> Tick) ]

// view:
Spinner.labeled theme.accent theme.fgMuted model.Tick "working…"