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

A horizontal progress bar widget. More...

Inheritance diagram for ConsoleForge.Widgets.ProgressBar:

Public Member Functions

 ProgressBar ()
 Object-initializer constructor.
 ProgressBar (double value, double maximum=100, bool showPercent=true, char fillChar='█', char emptyChar='░', Style? style=null)
 Positional constructor for inline usage.
void Render (IRenderContext ctx)
 Renders the progress bar into ctx 's allocated region.

Properties

char EmptyChar = '░' [get]
 Character used for the empty portion. Default '░'.
Style EmptyStyle = Style.Default [get]
 Style applied to the empty portion. Inherits widget style when unset.
char FillChar = '█' [get]
 Character used for the filled portion. Default '█'.
Style FillStyle = Style.Default [get]
 Style applied to the filled portion. Inherits widget style when unset.
SizeConstraint Height = SizeConstraint.Fixed(1) [get]
 Vertical size constraint. Defaults to SizeConstraint.Fixed(int) 1 (single row).
double Maximum = 100 [get]
 Maximum value. Must be > 0. Default 100.
bool ShowPercent = true [get]
 When true, a percentage label (e.g.
Style Style = Style.Default [get]
 Base style applied to the entire widget. Inherits from the active theme when unset.
double Value [get]
 Current progress value. Clamped to [0, Maximum].
SizeConstraint Width = SizeConstraint.Flex(1) [get]
 Horizontal size constraint. Defaults to SizeConstraint.Flex(int) weight 1 (fill available width).

Detailed Description

A horizontal progress bar widget.

Fills a region proportionally based on Value relative to Maximum.

Member Function Documentation

◆ Render()

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

Renders the progress bar into ctx 's allocated region.

Draws a filled portion followed by an empty portion, then an optional percentage label at the right edge.

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

Implements ConsoleForge.Layout.IWidget.

Property Documentation

◆ ShowPercent

bool ConsoleForge.Widgets.ProgressBar.ShowPercent = true
get

When true, a percentage label (e.g.

" 42%") is rendered at the right edge of the bar.


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