Collapsible
ConsoleMonster.Interactive
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
- InputControl
- Collapsible
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.
Returned or exposed by 22
- Property Accordion.Sections
- Method AppInput.Collapsible
- Extension method Collapsible.AddBinding
- Extension method Collapsible.AddBindings
- Extension method Collapsible.Content
- Extension method Collapsible.Disabled
- Extension method Collapsible.Expanded
- Extension method Collapsible.Label
- Extension method Collapsible.Summary
- Extension method Collapsible.TabIndex
- Extension method Collapsible.ValidationMessage
- Extension method CollapsibleInputOptions.Build
- Method InteractiveFluent.AddBinding
- Method InteractiveFluent.AddBindings
- Method InteractiveFluent.Content
- Method InteractiveFluent.Disabled
- Method InteractiveFluent.Expanded
- Method InteractiveFluent.Label
- Method InteractiveFluent.Summary
- Method InteractiveFluent.TabIndex
- Method InteractiveFluent.ValidationMessage
- Method UiConstruction.Build
Accepted by parameters 20
- Constructor Accordion.Accordion
- Method Accordion.Add
- Extension method Collapsible.AddBinding
- Extension method Collapsible.AddBindings
- Extension method Collapsible.Content
- Extension method Collapsible.Disabled
- Extension method Collapsible.Expanded
- Extension method Collapsible.Label
- Extension method Collapsible.Summary
- Extension method Collapsible.TabIndex
- Extension method Collapsible.ValidationMessage
- Method InteractiveFluent.AddBinding
- Method InteractiveFluent.AddBindings
- Method InteractiveFluent.Content
- Method InteractiveFluent.Disabled
- Method InteractiveFluent.Expanded
- Method InteractiveFluent.Label
- Method InteractiveFluent.Summary
- Method InteractiveFluent.TabIndex
- Method InteractiveFluent.ValidationMessage
Constructors
public Collapsible(string key, IWidget? content = null) #Creates a section.
Parameters
- key string
- The application-state key holding whether the section is expanded.
- content ConsoleMonster.Layout.IWidget? = null
- The folded content.
Inherited Methods
public bool HandleInput(InputEvent input, RenderContext context) #Parameters
- input InputEvent
- context RenderContext
Returns
boolpublic Size Measure(Constraints constraints, RenderContext context) #Parameters
- constraints Constraints
- context RenderContext
Returns
Sizepublic void Render(Region region, RenderContext context) #Parameters
- region Region
- context RenderContext
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.
Inherited Properties
Inherited Events
public event EventHandler<AppValueChangedEventArgs>? Changed #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
- The instance.
- item ConsoleMonster.Interactive.KeyBinding
- The item.
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
- The instance.
- items ConsoleMonster.Interactive.KeyBinding[]
- The items, in order.
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
- The instance.
- items System.Collections.Generic.IEnumerable<ConsoleMonster.Interactive.KeyBinding>
- The items, in order.
public static Collapsible Content(Collapsible collapsible, IWidget? value) #Sets Collapsible.Content: The content shown under the header while expanded.
Parameters
- collapsible ConsoleMonster.Interactive.Collapsible
- The instance.
- value ConsoleMonster.Layout.IWidget?
- The value.
Examples
// C# initializer or property // C# fluent
collapsible.Content = value; collapsible.Content(value);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
- The instance.
- value bool
- The value.
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
- The instance to configure.
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
- The instance.
- value bool
- The value.
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
- The instance to configure.
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
- The instance.
- value string?
- The value.
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
- The instance.
- value string?
- The value.
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
- The instance.
- value int
- The value.
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
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
collapsible.ValidationMessage = value; collapsible.ValidationMessage(value);