Skip to content
ConsoleMonster

API Reference

Class

Ui

Namespace ConsoleMonster
Assembly ConsoleMonster
Source Ui.cs:25
Modifiers static

Factories that let a layout read like the screen, for using static ConsoleMonster.Ui;: Terminal.Write(Rows( Columns( Panel("Servers", Table(servers).Column(s => s.Name, c => c.WithIsKey()).WithTotals()), Panel("Summary", KeyValue(("Servers", 3), ("Failed", 1)))), Text("[muted]updated 10:02[/]"))); Each one only creates the widget it names (the same object model as new Panel(...)), so the result can be configured further with object initializers or the generated With... methods. For layouts whose live widgets are needed as typed handles, DashboardBuilder hands them back through out parameters.

Inheritance

  • Object
  • Ui

Methods

public static Columns Columns(params IWidget[] children) #
Returns: Columns

Children side by side, sharing the width equally unless sized (Columns).

Parameters

children ConsoleMonster.Layout.IWidget[] requiredposition: 0
The children; wrap one in Ui.Fill or Ui.Fixed to size it.

Returns

The columns.

public static Dashboard Dashboard(String title, IWidget body) #
Returns: Dashboard

A dashboard shell (header, body and key footer) for a live session (Dashboard).

Parameters

title System.String requiredposition: 0
The title (markup).
body ConsoleMonster.Layout.IWidget requiredposition: 1
The body.

Returns

The dashboard.

public static Sized Fill(IWidget widget, Double weight = 1) #
Returns: Sized

A child that takes a share of the remaining height (in rows) or width (in columns).

Parameters

widget ConsoleMonster.Layout.IWidget requiredposition: 0
The child.
weight System.Double = 1 optionalposition: 1
Its share relative to other filling children (default 1).

Returns

The sized child.

public static Sized Fixed(IWidget widget, Int32 cells) #
Returns: Sized

A child with a fixed height (in rows) or width (in columns).

Parameters

widget ConsoleMonster.Layout.IWidget requiredposition: 0
The child.
cells System.Int32 requiredposition: 1
The size in rows or cells.

Returns

The sized child.

public static Grid Grid(Int32 columns, params IWidget[] children) #
Returns: Grid

Children in a grid with a number of columns, filled row by row (Grid).

Parameters

columns System.Int32 requiredposition: 0
The number of columns.
children ConsoleMonster.Layout.IWidget[] requiredposition: 1
The children.

Returns

The grid.

public static KeyValueList KeyValue(params ValueTuple<String, Object?>[] items) #
Returns: KeyValueList

Key/value pairs, values formatted by their type (KeyValueList).

Parameters

items System.ValueTuple<System.String, System.Object?>[] requiredposition: 0
The pairs, in order.

Returns

The list.

public static Lanes Lanes(params String[] keys) #
Returns: Lanes

Progress lanes, one per key (Lanes), each waiting to start.

Parameters

keys System.String[] requiredposition: 0
The lane keys (also their labels).

Returns

The lanes.

Node 2 overloads
public static TreeNode Node(String label, params TreeNode[] children) #
Returns: TreeNode

A tree node with children (TreeNode).

Parameters

label System.String requiredposition: 0
The label (markup).
children ConsoleMonster.Widgets.TreeNode[] requiredposition: 1
The child nodes.

Returns

The node.

public static TreeNode Node(String label, StatusKind? status, params TreeNode[] children) #
Returns: TreeNode

A tree node with a state marker and children (TreeNode).

Parameters

label System.String requiredposition: 0
The label (markup).
status ConsoleMonster.Styling.StatusKind? requiredposition: 1
The state shown before the label, or null.
children ConsoleMonster.Widgets.TreeNode[] requiredposition: 2
The child nodes.

Returns

The node.

public static Panel Panel(String title, IWidget content) #
Returns: Panel

A titled panel around content (Panel).

Parameters

title System.String requiredposition: 0
The title (markup).
content ConsoleMonster.Layout.IWidget requiredposition: 1
The content.

Returns

The panel.

public static ProgressBar Progress(String label, Double value = 0, Double total = 100) #
Returns: ProgressBar

A progress bar (ProgressBar).

Parameters

label System.String requiredposition: 0
The label (markup).
value System.Double = 0 optionalposition: 1
The current value.
total System.Double = 100 optionalposition: 2
The total (0 for an unknown total).

Returns

The progress bar.

public static Rows Rows(params IWidget[] children) #
Returns: Rows

Children stacked top to bottom (Rows).

Parameters

children ConsoleMonster.Layout.IWidget[] requiredposition: 0
The children; wrap one in Ui.Fill or Ui.Fixed to size it.

Returns

The rows.

public static Rule Rule(String? title = null) #
Returns: Rule

A horizontal rule with an optional title (Rule).

Parameters

title System.String? = null optionalposition: 0
The title (markup), or null.

Returns

The rule.

public static Sparkline Sparkline(IEnumerable<Double> values) #
Returns: Sparkline

A sparkline of values (Sparkline).

Parameters

values System.Collections.Generic.IEnumerable<System.Double> requiredposition: 0
The values, oldest first.

Returns

The sparkline.

public static StatusList Status(params ValueTuple<String, StatusKind>[] items) #
Returns: StatusList

A list of labelled states (StatusList).

Parameters

items System.ValueTuple<System.String, ConsoleMonster.Styling.StatusKind>[] requiredposition: 0
The labels and their states, in order.

Returns

The status list.

public static Table Table() #
Returns: Table

An empty table, to fill with columns and rows.

Returns

The table.

public static Table<T?> Table<T>(IEnumerable<T?> items) #
Returns: Table<T?>

A table whose rows are read from typed items (Table.For).

Type Parameters

T
The item type.

Parameters

items System.Collections.Generic.IEnumerable<T?> requiredposition: 0
The items.

Returns

The table; add columns with Column(s => s.Name).

public static TextBlock Text(String markup) #
Returns: TextBlock

Text with markup (TextBlock); [bold], [pass], [muted] and the other tags apply.

Parameters

markup System.String requiredposition: 0
The markup.

Returns

The text block.

public static Tree Tree(String? root, params TreeNode[] nodes) #
Returns: Tree

A tree with a root label and nodes (Tree).

Parameters

root System.String? requiredposition: 0
The root label (markup), or null to show the nodes as top level.
nodes ConsoleMonster.Widgets.TreeNode[] requiredposition: 1
The nodes under the root.

Returns

The tree.