Skip to content
ConsoleMonster
Class

Panel

ConsoleMonster.Layout

Namespace
ConsoleMonster.Layout
Assembly
ConsoleMonster
Implements
IContainer IWidget IContentOwner
Modifiers
sealed

A bordered box with a title in the top edge, an optional caption on the right of the top edge (counts, clocks) and an optional footer in the bottom edge. Borders follow the glyph tier (rounded on Full, single on Basic, +-| on Ascii). Inside a Columns row, panels stretch to the row height.

Inheritance

  • object
  • Panel

Usage

Explore 64 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.

Returned or exposed by 31

Accepted by parameters 33

Constructors

Panel 2 overloads
public Panel(IWidget content, RichText title) #

Creates a panel with a multicolour title.

Parameters

content ConsoleMonster.Layout.IWidget required
The content.
title ConsoleMonster.Text.RichText required
The title.
public Panel(IWidget? content = null, string? title = null) #

Creates a panel around a content with an optional title (markup).

Parameters

content ConsoleMonster.Layout.IWidget? = null optional
The content.
title string? = null optional
The title, or null.

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 IWidget Content { get; set; } #

The content.

public int Gap { get; set; } #

Blank rows between content children when the content is several widgets, as a report usually is (default 0).

public string? Title { get; set; } #

The title shown in the top edge (markup).

public string? HeaderRight { get; set; } #

Text on the right of the top edge (markup), for example a count or a clock.

public string? Caption { get; set; } #

Text on the right of the bottom edge (markup), for example "+12 more".

public BoxStyle Border { get; set; } #

The border style (default rounded).

public ThemeToken BorderRole { get; set; } #

The theme token for the border (default ThemeToken.Border).

public bool Verdict { get; set; } #

Uses a double border and a centred title for a verdict.

public StatusKind? Status { get; set; } #

Optional status colour and title glyph for a verdict.

public int PaddingLeft { get; set; } #

Cells between the left border and the content (default 1).

public int PaddingRight { get; set; } #

Cells between the content and the right border (default 1).

public int PaddingTop { get; set; } #

Rows between the top border and the content (default 0).

public int PaddingBottom { get; set; } #

Rows between the content and the bottom border (default 0).

public bool Expand { get; set; } #

Whether the panel takes the full available width (default true).

public int? Height { get; set; } #

A fixed total height including borders, or null to fit the content.

public IReadOnlyList<IWidget> Children { get; } #

The child widgets in layout order.

Extension Methods

public static Panel Border(Panel panel, BoxStyle value) #

Sets Panel.Border: The border style (default rounded).

Parameters

panel ConsoleMonster.Layout.Panel required
The instance.
value ConsoleMonster.Glyphs.BoxStyle required
The value.

Returns

Panel The same instance.

Examples

// C# initializer or property                                  // C# fluent
new global::ConsoleMonster.Layout.Panel { Border = value };    Ui.Panel().Border(value);
public static Panel BorderRole(Panel panel, ThemeToken value) #

Sets Panel.BorderRole: The theme token for the border (default ThemeToken.Border).

Parameters

panel ConsoleMonster.Layout.Panel required
The instance.
value ConsoleMonster.Styling.ThemeToken required
The value.

Returns

Panel The same instance.

Examples

// C# initializer or property                                      // C# fluent
new global::ConsoleMonster.Layout.Panel { BorderRole = value };    Ui.Panel().BorderRole(value);
public static Panel Caption(Panel panel, string? value) #

Sets Panel.Caption: Text on the right of the bottom edge (markup), for example "+12 more".

Parameters

panel ConsoleMonster.Layout.Panel required
The instance.
value string? required
The value.

Returns

Panel The same instance.

Examples

// C# initializer or property                                   // C# fluent
new global::ConsoleMonster.Layout.Panel { Caption = value };    Ui.Panel().Caption(value);
Content 2 overloads
public static Panel Content(Panel panel, IWidget content) #

Configures this container's content before session ownership.

Parameters

panel ConsoleMonster.Layout.Panel required
The instance.
content ConsoleMonster.Layout.IWidget required
The widget or nested content builder.

Returns

Panel The same instance.
public static Panel Content(Panel panel, Action<ContentBuilder> content) #

Configures this container's content before session ownership.

Parameters

panel ConsoleMonster.Layout.Panel required
The instance.
content System.Action<ConsoleMonster.Layout.ContentBuilder> required
The widget or nested content builder.

Returns

Panel The same instance.
public static Panel Expand(Panel panel, bool value = true) #

Sets Panel.Expand: Whether the panel takes the full available width (default true).

Parameters

panel ConsoleMonster.Layout.Panel required
The instance.
value bool = true optional
The value; true when omitted.

Returns

Panel The same instance.

Examples

// C# initializer or property                                  // C# fluent
new global::ConsoleMonster.Layout.Panel { Expand = value };    Ui.Panel().Expand(value);
public static Panel Gap(Panel panel, int value) #

Sets Panel.Gap: Blank rows between content children when the content is several widgets, as a report usually is (default 0).

Parameters

panel ConsoleMonster.Layout.Panel required
The instance.
value int required
The value.

Returns

Panel The same instance.

Examples

// C# initializer or property                               // C# fluent
new global::ConsoleMonster.Layout.Panel { Gap = value };    Ui.Panel().Gap(value);
public static Panel HeaderRight(Panel panel, string? value) #

Sets Panel.HeaderRight: Text on the right of the top edge (markup), for example a count or a clock.

Parameters

panel ConsoleMonster.Layout.Panel required
The instance.
value string? required
The value.

Returns

Panel The same instance.

Examples

// C# initializer or property                                       // C# fluent
new global::ConsoleMonster.Layout.Panel { HeaderRight = value };    Ui.Panel().HeaderRight(value);
public static Panel Height(Panel panel, int? value) #

Sets Panel.Height: A fixed total height including borders, or null to fit the content.

Parameters

panel ConsoleMonster.Layout.Panel required
The instance.
value int? required
The value.

Returns

Panel The same instance.

Examples

// C# initializer or property                                  // C# fluent
new global::ConsoleMonster.Layout.Panel { Height = value };    Ui.Panel().Height(value);
public static Panel PaddingBottom(Panel panel, int value) #

Sets Panel.PaddingBottom: Rows between the content and the bottom border (default 0).

Parameters

panel ConsoleMonster.Layout.Panel required
The instance.
value int required
The value.

Returns

Panel The same instance.

Examples

// C# initializer or property                                         // C# fluent
new global::ConsoleMonster.Layout.Panel { PaddingBottom = value };    Ui.Panel().PaddingBottom(value);
public static Panel PaddingLeft(Panel panel, int value) #

Sets Panel.PaddingLeft: Cells between the left border and the content (default 1).

Parameters

panel ConsoleMonster.Layout.Panel required
The instance.
value int required
The value.

Returns

Panel The same instance.

Examples

// C# initializer or property                                       // C# fluent
new global::ConsoleMonster.Layout.Panel { PaddingLeft = value };    Ui.Panel().PaddingLeft(value);
public static Panel PaddingRight(Panel panel, int value) #

Sets Panel.PaddingRight: Cells between the content and the right border (default 1).

Parameters

panel ConsoleMonster.Layout.Panel required
The instance.
value int required
The value.

Returns

Panel The same instance.

Examples

// C# initializer or property                                        // C# fluent
new global::ConsoleMonster.Layout.Panel { PaddingRight = value };    Ui.Panel().PaddingRight(value);
public static Panel PaddingTop(Panel panel, int value) #

Sets Panel.PaddingTop: Rows between the top border and the content (default 0).

Parameters

panel ConsoleMonster.Layout.Panel required
The instance.
value int required
The value.

Returns

Panel The same instance.

Examples

// C# initializer or property                                      // C# fluent
new global::ConsoleMonster.Layout.Panel { PaddingTop = value };    Ui.Panel().PaddingTop(value);
public static Panel Status(Panel panel, StatusKind? value) #

Sets Panel.Status: Optional status colour and title glyph for a verdict.

Parameters

panel ConsoleMonster.Layout.Panel required
The instance.
value ConsoleMonster.Styling.StatusKind? required
The value.

Returns

Panel The same instance.

Examples

// C# initializer or property                                  // C# fluent
new global::ConsoleMonster.Layout.Panel { Status = value };    Ui.Panel().Status(value);
public static Panel Title(Panel panel, string? value) #

Sets Panel.Title: The title shown in the top edge (markup).

Parameters

panel ConsoleMonster.Layout.Panel required
The instance.
value string? required
The value.

Returns

Panel The same instance.

Examples

// C# initializer or property                                 // C# fluent
new global::ConsoleMonster.Layout.Panel { Title = value };    Ui.Panel().Title(value);
public static Panel Verdict(Panel panel, bool value = true) #

Sets Panel.Verdict: Uses a double border and a centred title for a verdict.

Parameters

panel ConsoleMonster.Layout.Panel required
The instance.
value bool = true optional
The value; true when omitted.

Returns

Panel The same instance.

Examples

// C# initializer or property                                   // C# fluent
new global::ConsoleMonster.Layout.Panel { Verdict = value };    Ui.Panel().Verdict(value);