Table of Contents

Class Prompt

Namespace
ConsoleAppVisuals.InteractiveElements
Assembly
ConsoleAppVisuals.dll

The Prompt is an interactive element that allows the user to input a string response.

public class Prompt : InteractiveElement<string>
Inheritance
Prompt
Inherited Members

Remarks

For more information, consider visiting the documentation available here.

Constructors

Prompt(string, string?, Placement, int, PromptInputStyle, BordersType)

The Prompt is an interactive element that allows the user to input a string response.

public Prompt(string question, string? defaultValue = null, Placement placement = Placement.TopCenter, int maxInputLength = 12, PromptInputStyle style = PromptInputStyle.Default, BordersType borderType = BordersType.SingleStraight)

Parameters

question string

The text on the left of the prompt element.

defaultValue string

The text in the center of the prompt element.

placement Placement

The placement of the prompt element.

maxInputLength int

The maximum length of the response.

style PromptInputStyle

The style of the prompt input.

borderType BordersType

The type of border to use for the element.

Remarks

For more information, consider visiting the documentation available here.

Properties

Borders

Gets the borders of the prompt element.

public Borders Borders { get; }

Property Value

Borders

BordersType

Gets the border type of the selector.

public BordersType BordersType { get; }

Property Value

BordersType

DefaultValue

Gets the default value of the response.

public string DefaultValue { get; }

Property Value

string

Height

Gets the height of the prompt element.

public override int Height { get; }

Property Value

int

MaxInputLength

Gets the maximum length of the response.

public int MaxInputLength { get; }

Property Value

int

Placement

Gets the placement of the prompt element.

public override Placement Placement { get; }

Property Value

Placement

Question

Gets the question of the prompt element.

public string Question { get; }

Property Value

string

Selector

Gets the selector of the prompt element.

public char Selector { get; }

Property Value

char

Style

Gets the style of the prompt input.

public PromptInputStyle Style { get; }

Property Value

PromptInputStyle

Width

Gets the width of the prompt element.

public override int Width { get; }

Property Value

int

Methods

RenderElementActions()

Defines the actions to perform when the element is called to be rendered on the console.

[Visual]
protected override void RenderElementActions()

UpdateBordersType(BordersType)

Updates the border type of the prompt element.

public void UpdateBordersType(BordersType bordersType)

Parameters

bordersType BordersType

The new border type of the prompt element.

Remarks

For more information, consider visiting the documentation available here.

UpdateDefaultValue(string?)

Updates the default value of the prompt element.

public void UpdateDefaultValue(string? defaultValue)

Parameters

defaultValue string

The new default value of the prompt element.

Remarks

For more information, consider visiting the documentation available here.

UpdateMaxLength(int)

Updates the maximum length of the response.

public void UpdateMaxLength(int maxLength)

Parameters

maxLength int

The new maximum length of the response.

Remarks

For more information, consider visiting the documentation available here.

Exceptions

ArgumentOutOfRangeException

The maximum length of the response must be greater than 0 and less than the width of the console window.

UpdatePlacement(Placement)

Updates the placement of the prompt element.

public void UpdatePlacement(Placement placement)

Parameters

placement Placement

The new placement of the prompt element.

Remarks

For more information, consider visiting the documentation available here.

UpdateQuestion(string)

Updates the question of the prompt element.

public void UpdateQuestion(string question)

Parameters

question string

The new question of the prompt element.

Remarks

For more information, consider visiting the documentation available here.

UpdateSelector(char)

Updates the selector of the prompt element.

public void UpdateSelector(char selector = '▶')

Parameters

selector char

The new selector of the prompt element.

Remarks

For more information, consider visiting the documentation available here.

UpdateStyle(PromptInputStyle)

Updates the style of the prompt input.

public void UpdateStyle(PromptInputStyle style)

Parameters

style PromptInputStyle

The new style of the prompt input.

Remarks

For more information, consider visiting the documentation available here.