Skip to content
ConsoleMonster
Class

FormDialog<T>

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Modifiers
sealed

A modal form composed from ordinary named inputs, with validation and a typed result.

Inheritance

  • object
  • FormDialog<T>

Usage

Explore 2 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 1

Accepted by parameters 1

Type Parameters

T

Constructors

public FormDialog<T>(string title, IWidget content, Func<AppState, T?> result) #

Creates a form. The result callback runs on the app thread after validation.

Parameters

title string required
content ConsoleMonster.Layout.IWidget required
result System.Func<ConsoleMonster.Interactive.AppState, T?> required

Properties

public string Title { get; } #

The visible dialog title.

public IWidget Content { get; } #

The retained form fields.

public Func<AppState, T?> Result { get; } #

Maps committed field values to the result.

public Func<AppState, string?>? Validate { get; set; } #

Returns an error to keep the form open, or null to accept.

public string AcceptText { get; set; } #

The affirmative button label.

public string CancelText { get; set; } #

The cancellation button label.

public bool DefaultAccept { get; set; } #

Whether Enter initially chooses the affirmative button. False defaults to Cancel.

public string? InitialFocus { get; set; } #

Optional field key to focus initially instead of the default button.

public int MaxWidth { get; set; } #

Maximum dialog width.