Skip to content
ConsoleMonster
Class

Collapsible

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Modifiers
sealed

A section that folds: a focusable header row with ▸/▾ (+/- in ASCII) above its content. Collapsed, the header shows Collapsible.Summary ("Examples (6)") and the content is not mounted, so its inputs leave the focus order. Enter, Space, ←/→ and a click on the header fold and unfold it; the value is whether it is expanded.

Inheritance

Usage

Explore 42 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 20

Constructors

public Collapsible(string key, IWidget? content = null) #

Creates a section.

Parameters

key string required
The application-state key holding whether the section is expanded.
content ConsoleMonster.Layout.IWidget? = null optional
The folded content.

Properties

public IWidget? Content { get; set; } #

The content shown under the header while expanded.

public bool Expanded { get; set; } #

Whether the content is shown. Assignments notify only when the value changes.

public string? Summary { get; set; } #

Muted text after the label while collapsed, such as a count; null shows the label alone.

public IReadOnlyList<IWidget> Children { get; } #

The child widgets in layout order.

Extension Methods

public static Collapsible AddBinding(Collapsible collapsible, KeyBinding item) #

Adds an item to InputControl.Bindings: Keys that apply while this control has focus. They reach the control before its own keys (so Enter can open the selected row) and feed the app footer.

Parameters

collapsible ConsoleMonster.Interactive.Collapsible required
The instance.
item ConsoleMonster.Interactive.KeyBinding required
The item.

Returns

Collapsible The same instance.
AddBindings 2 overloads
public static Collapsible AddBindings(Collapsible collapsible, params KeyBinding[] items) #

Adds items to InputControl.Bindings: Keys that apply while this control has focus. They reach the control before its own keys (so Enter can open the selected row) and feed the app footer.

Parameters

collapsible ConsoleMonster.Interactive.Collapsible required
The instance.
items ConsoleMonster.Interactive.KeyBinding[] required
The items, in order.

Returns

Collapsible The same instance.
public static Collapsible AddBindings(Collapsible collapsible, IEnumerable<KeyBinding> items) #

Adds items to InputControl.Bindings: Keys that apply while this control has focus. They reach the control before its own keys (so Enter can open the selected row) and feed the app footer.

Parameters

collapsible ConsoleMonster.Interactive.Collapsible required
The instance.
items System.Collections.Generic.IEnumerable<ConsoleMonster.Interactive.KeyBinding> required
The items, in order.

Returns

Collapsible The same instance.
public static Collapsible Content(Collapsible collapsible, IWidget? value) #

Sets Collapsible.Content: The content shown under the header while expanded.

Parameters

collapsible ConsoleMonster.Interactive.Collapsible required
The instance.
value ConsoleMonster.Layout.IWidget? required
The value.

Returns

Collapsible The same instance.

Examples

// C# initializer or property    // C# fluent
collapsible.Content = value;     collapsible.Content(value);
Disabled 2 overloads
public static Collapsible Disabled(Collapsible collapsible, bool value) #

Sets InputControl.Disabled: Whether this control is excluded from input and focus traversal.

Parameters

collapsible ConsoleMonster.Interactive.Collapsible required
The instance.
value bool required
The value.

Returns

Collapsible The same instance.

Examples

// C# initializer or property    // C# fluent
collapsible.Disabled = value;    collapsible.Disabled(value);
public static Collapsible Disabled(Collapsible collapsible) #

Sets InputControl.Disabled to true.

Parameters

collapsible ConsoleMonster.Interactive.Collapsible required
The instance to configure.

Returns

Collapsible The same instance.
Expanded 2 overloads
public static Collapsible Expanded(Collapsible collapsible, bool value) #

Sets Collapsible.Expanded: Whether the content is shown. Assignments notify only when the value changes.

Parameters

collapsible ConsoleMonster.Interactive.Collapsible required
The instance.
value bool required
The value.

Returns

Collapsible The same instance.

Examples

// C# initializer or property    // C# fluent
collapsible.Expanded = value;    collapsible.Expanded(value);
public static Collapsible Expanded(Collapsible collapsible) #

Sets Collapsible.Expanded to true.

Parameters

collapsible ConsoleMonster.Interactive.Collapsible required
The instance to configure.

Returns

Collapsible The same instance.
public static Collapsible Label(Collapsible collapsible, string? value) #

Sets InputControl.Label: The visible label, or null to use the name.

Parameters

collapsible ConsoleMonster.Interactive.Collapsible required
The instance.
value string? required
The value.

Returns

Collapsible The same instance.

Examples

// C# initializer or property    // C# fluent
collapsible.Label = value;       collapsible.Label(value);
public static Collapsible Summary(Collapsible collapsible, string? value) #

Sets Collapsible.Summary: Muted text after the label while collapsed, such as a count; null shows the label alone.

Parameters

collapsible ConsoleMonster.Interactive.Collapsible required
The instance.
value string? required
The value.

Returns

Collapsible The same instance.

Examples

// C# initializer or property    // C# fluent
collapsible.Summary = value;     collapsible.Summary(value);
public static Collapsible TabIndex(Collapsible collapsible, int value) #

Sets InputControl.TabIndex: Focus order; equal values preserve declaration order.

Parameters

collapsible ConsoleMonster.Interactive.Collapsible required
The instance.
value int required
The value.

Returns

Collapsible The same instance.

Examples

// C# initializer or property    // C# fluent
collapsible.TabIndex = value;    collapsible.TabIndex(value);
public static Collapsible ValidationMessage(Collapsible collapsible, string? value) #

Sets InputControl.ValidationMessage: The current validation message below the control, or null.

Parameters

collapsible ConsoleMonster.Interactive.Collapsible required
The instance.
value string? required
The value.

Returns

Collapsible The same instance.

Examples

// C# initializer or property             // C# fluent
collapsible.ValidationMessage = value;    collapsible.ValidationMessage(value);