Skip to content
ConsoleMonster
Class

Responsive

ConsoleMonster.Layout

Namespace
ConsoleMonster.Layout
Assembly
ConsoleMonster
Modifiers
sealed

Shows one of several layouts by the width it is given: the widest breakpoint that fits, otherwise the fallback. Use it when a view needs a different shape, not just a narrower one, such as one cell per server on a wide terminal and one cell per site on a narrow one. Every layout stays a child, so live updates reach the hidden ones too and a resize shows current values.

Inheritance

  • object
  • Responsive

Usage

Explore 5 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 3

Accepted by parameters 2

Constructors

public Responsive(IWidget fallback) #

Creates a responsive container.

Parameters

fallback ConsoleMonster.Layout.IWidget required
The layout shown below every breakpoint.

Methods

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.
public Responsive When(int minWidth, IWidget content) #

Adds a layout shown when at least minWidth cells are available; a second layout for the same width replaces the first.

Parameters

minWidth int required
The narrowest width, in cells, for this layout.
content ConsoleMonster.Layout.IWidget required
The layout.

Returns

Responsive This container.

Properties

public IWidget Fallback { get; set; } #

The layout shown below every breakpoint.

public IReadOnlyList<IWidget> Children { get; } #

The child widgets in layout order.

Extension Methods

public static Responsive Fallback(Responsive responsive, IWidget value) #

Sets Responsive.Fallback: The layout shown below every breakpoint.

Parameters

responsive ConsoleMonster.Layout.Responsive required
The instance.
value ConsoleMonster.Layout.IWidget required
The value.

Returns

Responsive The same instance.

Examples

// C# initializer or property    // C# fluent
responsive.Fallback = value;     responsive.Fallback(value);