Skip to content
ConsoleMonster

API Reference

Class

Panel

Namespace ConsoleMonster.Layout
Assembly ConsoleMonster
Implements
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 45 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 22

Constructors

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

Creates a panel with a multicolour title.

Parameters

child ConsoleMonster.Layout.IWidget requiredposition: 0
The content.
title ConsoleMonster.Text.RichText requiredposition: 1
The title.
public Panel(IWidget child, String? title = null) #

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

Parameters

child ConsoleMonster.Layout.IWidget requiredposition: 0
The child.
title System.String? = null optionalposition: 1
The title, or null.

Methods

public Size Measure(Constraints constraints, RenderContext context) #
Returns: Size

Returns the size the widget wants within the constraints.

Parameters

constraints ConsoleMonster.Layout.Constraints requiredposition: 0
The space offered.
context ConsoleMonster.Canvas.RenderContext requiredposition: 1
Profile, theme and glyphs.

Returns

The desired size, never larger than the constraints.

public Void Render(Region region, RenderContext context) #
Returns: Void

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

Parameters

region ConsoleMonster.Canvas.Region requiredposition: 0
The target region.
context ConsoleMonster.Canvas.RenderContext requiredposition: 1
Profile, theme and glyphs.

Properties

public IWidget Child { get; } #

The content.

public String? Title { get; set; } #

The title shown in the top edge (markup).

public String? Caption { get; set; } #

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

public BoxStyle Border { get; set; } #

The border style (default rounded).

public ThemeToken BorderToken { get; set; } #

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

public Int32 PaddingLeft { get; set; } #

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

public Int32 PaddingRight { get; set; } #

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

public Int32 PaddingTop { get; set; } #

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

public Int32 PaddingBottom { get; set; } #

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

public Boolean Expand { get; set; } #

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

public Int32? 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 WithBorder(Panel panel, BoxStyle value) #
Returns: Panel

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

Parameters

panel ConsoleMonster.Layout.Panel requiredposition: 0
The instance.
value ConsoleMonster.Glyphs.BoxStyle requiredposition: 1
The value.

Returns

The same instance.

public static Panel WithBorderToken(Panel panel, ThemeToken value) #
Returns: Panel

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

Parameters

panel ConsoleMonster.Layout.Panel requiredposition: 0
The instance.
value ConsoleMonster.Styling.ThemeToken requiredposition: 1
The value.

Returns

The same instance.

public static Panel WithCaption(Panel panel, String? value) #
Returns: Panel

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

Parameters

panel ConsoleMonster.Layout.Panel requiredposition: 0
The instance.
value System.String? requiredposition: 1
The value.

Returns

The same instance.

public static Panel WithExpand(Panel panel, Boolean value = true) #
Returns: Panel

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

Parameters

panel ConsoleMonster.Layout.Panel requiredposition: 0
The instance.
value System.Boolean = true optionalposition: 1
The value (default true).

Returns

The same instance.

public static Panel WithFooter(Panel panel, String? value) #
Returns: Panel

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

Parameters

panel ConsoleMonster.Layout.Panel requiredposition: 0
The instance.
value System.String? requiredposition: 1
The value.

Returns

The same instance.

public static Panel WithHeight(Panel panel, Int32? value) #
Returns: Panel

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

Parameters

panel ConsoleMonster.Layout.Panel requiredposition: 0
The instance.
value System.Int32? requiredposition: 1
The value.

Returns

The same instance.

public static Panel WithPaddingBottom(Panel panel, Int32 value) #
Returns: Panel

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

Parameters

panel ConsoleMonster.Layout.Panel requiredposition: 0
The instance.
value System.Int32 requiredposition: 1
The value.

Returns

The same instance.

public static Panel WithPaddingLeft(Panel panel, Int32 value) #
Returns: Panel

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

Parameters

panel ConsoleMonster.Layout.Panel requiredposition: 0
The instance.
value System.Int32 requiredposition: 1
The value.

Returns

The same instance.

public static Panel WithPaddingRight(Panel panel, Int32 value) #
Returns: Panel

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

Parameters

panel ConsoleMonster.Layout.Panel requiredposition: 0
The instance.
value System.Int32 requiredposition: 1
The value.

Returns

The same instance.

public static Panel WithPaddingTop(Panel panel, Int32 value) #
Returns: Panel

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

Parameters

panel ConsoleMonster.Layout.Panel requiredposition: 0
The instance.
value System.Int32 requiredposition: 1
The value.

Returns

The same instance.

public static Panel WithTitle(Panel panel, String? value) #
Returns: Panel

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

Parameters

panel ConsoleMonster.Layout.Panel requiredposition: 0
The instance.
value System.String? requiredposition: 1
The value.

Returns

The same instance.