Skip to content
ConsoleMonster
Class

HeaderBar

ConsoleMonster.Widgets

Namespace
ConsoleMonster.Widgets
Assembly
ConsoleMonster
Implements
IWidget
Modifiers
sealed

The one header bar of every full-screen surface (dashboards, the Shell app, full-screen forms, runs started from a menu): a row on the Surface band with the title in SurfaceAccent, then the breadcrumb or a subtitle, and on the right a status (with its marker), free text and the elapsed clock. Without colour the band is left out and the same text is drawn plain. See Docs/Design-System.md.

Inheritance

  • object
  • HeaderBar

Usage

Explore 40 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 21

Constructors

public HeaderBar(string title) #

Creates a header bar.

Parameters

title string required
The title (markup).

Methods

public Size Measure(Constraints constraints, RenderContext context) #

Returns the size the widget wants within the constraints.

Parameters

constraints ConsoleMonster.Layout.Constraints required
The space offered.
context ConsoleMonster.Canvas.RenderContext required
Profile, theme and glyphs.

Returns

Size The desired size, never larger than the constraints.
public void Render(Region region, RenderContext context) #

Renders into a region. The region may be smaller or larger than the measured size.

Parameters

region ConsoleMonster.Canvas.Region required
The target region.
context ConsoleMonster.Canvas.RenderContext required
Profile, theme and glyphs.

Properties

public string Title { get; set; } #

The title (markup).

public IList<string> Crumbs { get; } #

Breadcrumb steps after the title, plain text ("Tasks", "Review & run"). Left empty inside an app with AppScreens, the bar shows the open screens.

public string? Subtitle { get; set; } #

A subtitle after the title, separated by a dot (markup).

public string? Detail { get; set; } #

Status text on the right (markup).

public StatusKind? Status { get; set; } #

The status kind; its marker goes before the status text.

public string? HeaderRight { get; set; } #

Plain text on the right, before the clock (an app's subtitle, a step count).

public bool ShowElapsed { get; set; } #

Shows the elapsed clock on the right.

public TimeSpan? Elapsed { get; set; } #

The clock value; null uses the render context's elapsed time.

Extension Methods

public static HeaderBar Crumb(HeaderBar headerBar, string item) #

Adds an item to HeaderBar.Crumbs: Breadcrumb steps after the title, plain text ("Tasks", "Review & run"). Left empty inside an app with AppScreens, the bar shows the open screens.

Parameters

headerBar ConsoleMonster.Widgets.HeaderBar required
The instance.
item string required
The item.

Returns

HeaderBar The same instance.
public static HeaderBar Crumbs(HeaderBar headerBar, IEnumerable<string> items) #

Adds items to HeaderBar.Crumbs: Breadcrumb steps after the title, plain text ("Tasks", "Review & run"). Left empty inside an app with AppScreens, the bar shows the open screens.

Parameters

headerBar ConsoleMonster.Widgets.HeaderBar required
The instance.
items System.Collections.Generic.IEnumerable<string> required
The items, in order.

Returns

HeaderBar The same instance.
public static HeaderBar Detail(HeaderBar headerBar, string? value) #

Sets HeaderBar.Detail: Status text on the right (markup).

Parameters

headerBar ConsoleMonster.Widgets.HeaderBar required
The instance.
value string? required
The value.

Returns

HeaderBar The same instance.

Examples

// C# initializer or property    // C# fluent
headerBar.Detail = value;        Ui.HeaderBar().Detail(value);
public static HeaderBar Elapsed(HeaderBar headerBar, TimeSpan? value) #

Sets HeaderBar.Elapsed: The clock value; null uses the render context's elapsed time.

Parameters

headerBar ConsoleMonster.Widgets.HeaderBar required
The instance.
value System.TimeSpan? required
The value.

Returns

HeaderBar The same instance.

Examples

// C# initializer or property    // C# fluent
headerBar.Elapsed = value;       Ui.HeaderBar().Elapsed(value);
public static HeaderBar HeaderRight(HeaderBar headerBar, string? value) #

Sets HeaderBar.HeaderRight: Plain text on the right, before the clock (an app's subtitle, a step count).

Parameters

headerBar ConsoleMonster.Widgets.HeaderBar required
The instance.
value string? required
The value.

Returns

HeaderBar The same instance.

Examples

// C# initializer or property     // C# fluent
headerBar.HeaderRight = value;    Ui.HeaderBar().HeaderRight(value);
public static HeaderBar ShowElapsed(HeaderBar headerBar, bool value = true) #

Sets HeaderBar.ShowElapsed: Shows the elapsed clock on the right.

Parameters

headerBar ConsoleMonster.Widgets.HeaderBar required
The instance.
value bool = true optional
The value; true when omitted.

Returns

HeaderBar The same instance.

Examples

// C# initializer or property     // C# fluent
headerBar.ShowElapsed = value;    Ui.HeaderBar().ShowElapsed(value);
public static HeaderBar Status(HeaderBar headerBar, StatusKind? value) #

Sets HeaderBar.Status: The status kind; its marker goes before the status text.

Parameters

headerBar ConsoleMonster.Widgets.HeaderBar required
The instance.
value ConsoleMonster.Styling.StatusKind? required
The value.

Returns

HeaderBar The same instance.

Examples

// C# initializer or property    // C# fluent
headerBar.Status = value;        Ui.HeaderBar().Status(value);
public static HeaderBar Subtitle(HeaderBar headerBar, string? value) #

Sets HeaderBar.Subtitle: A subtitle after the title, separated by a dot (markup).

Parameters

headerBar ConsoleMonster.Widgets.HeaderBar required
The instance.
value string? required
The value.

Returns

HeaderBar The same instance.

Examples

// C# initializer or property    // C# fluent
headerBar.Subtitle = value;      Ui.HeaderBar().Subtitle(value);
public static HeaderBar Title(HeaderBar headerBar, string value) #

Sets HeaderBar.Title: The title (markup).

Parameters

headerBar ConsoleMonster.Widgets.HeaderBar required
The instance.
value string required
The value.

Returns

HeaderBar The same instance.

Examples

// C# initializer or property    // C# fluent
headerBar.Title = value;         Ui.HeaderBar().Title(value);