Skip to content
ConsoleMonster
Class

Accordion

ConsoleMonster.Interactive

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

Collapsible sections stacked as a group that keeps one open: expanding a section folds the others. While a header has focus, + expands every section for reading and - folds them all; both are ordinary key bindings on the sections, so the footer lists them.

Inheritance

  • object
  • Accordion

Usage

Explore 8 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 4

Accepted by parameters 4

Constructors

public Accordion(params Collapsible[] children) #

Creates a group.

Parameters

children ConsoleMonster.Interactive.Collapsible[] required
The sections, in order.

Methods

public Accordion Add(Collapsible section) #

Adds a section. Add every section before the app runs.

Parameters

section ConsoleMonster.Interactive.Collapsible required
The section; it can belong to one group.

Returns

Accordion This group.
public void CollapseAll() #

Folds every section.

public void ExpandAll() #

Expands every section until one is folded or opened on its own again.

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 IReadOnlyList<Collapsible> Sections { get; } #

The sections, in order.

public IReadOnlyList<IWidget> Children { get; } #

The child widgets in layout order.

Extension Methods

Content 2 overloads
public static Accordion Content(Accordion accordion, IWidget content) #

Configures this container's content before session ownership.

Parameters

accordion ConsoleMonster.Interactive.Accordion required
The instance.
content ConsoleMonster.Layout.IWidget required
The widget or nested content builder.

Returns

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

Configures this container's content before session ownership.

Parameters

accordion ConsoleMonster.Interactive.Accordion required
The instance.
content System.Action<ConsoleMonster.Layout.ContentBuilder> required
The widget or nested content builder.

Returns

Accordion The same instance.