ConsoleForge 0.3.0
Elm-architecture TUI framework for .NET 8
Loading...
Searching...
No Matches
ConsoleForge.Widgets.Spinner Class Referencesealed

An animated spinner widget. More...

Inheritance diagram for ConsoleForge.Widgets.Spinner:

Public Member Functions

void Render (IRenderContext ctx)
 Renders the current animation frame (and optional label) into ctx 's allocated region.
 Spinner ()
 Object-initializer constructor.
 Spinner (int frame, string? label=null, IReadOnlyList< string >? frames=null, Style? style=null)
 Positional constructor for inline usage.

Static Public Attributes

static readonly IReadOnlyList< string > ArcFrames
 Arc spinner frames.
static readonly IReadOnlyList< string > AsciiFrames
 Classic ASCII spinner frames.
static readonly IReadOnlyList< string > BrailleFrames
 Default braille dot spinner frames.

Properties

int Frame [get]
 Current animation frame index.
IReadOnlyList< string > Frames = BrailleFrames [get]
 The animation frames to cycle through. Defaults to BrailleFrames.
SizeConstraint Height = SizeConstraint.Auto [get]
 Vertical size constraint. Defaults to SizeConstraint.Auto (single row).
string? Label [get]
 Optional label displayed after the spinner frame (e.g.
Style Style = Style.Default [get]
 Base style applied to the spinner text. Inherits from the active theme when unset.
SizeConstraint Width = SizeConstraint.Auto [get]
 Horizontal size constraint. Defaults to SizeConstraint.Auto (sized to content).

Detailed Description

An animated spinner widget.

Cycles through a sequence of frames on each render. Models should advance Frame via a Cmd.Tick or Sub.Interval.

The spinner does not self-animate — it renders the frame at index Frame % Frames.Length. Advance Frame in your model's Update handler to produce motion.

Member Function Documentation

◆ Render()

void ConsoleForge.Widgets.Spinner.Render ( IRenderContext ctx)

Renders the current animation frame (and optional label) into ctx 's allocated region.

Content is truncated to fit the available width.

Parameters
ctxThe render context providing the target region, theme, and write methods.

Implements ConsoleForge.Layout.IWidget.

Property Documentation

◆ Frame

int ConsoleForge.Widgets.Spinner.Frame
get

Current animation frame index.

The spinner renders Frames[Frame % Frames.Length]. Increment this in your model to advance the animation.

◆ Label

string? ConsoleForge.Widgets.Spinner.Label
get

Optional label displayed after the spinner frame (e.g.

"Loading…"). A single space is inserted between the frame and the label.


The documentation for this class was generated from the following file:
  • src/ConsoleForge/Widgets/Spinner.cs