Cmdlet
New-ConsoleTextInput
Creates a named single-line text input for Show-ConsoleApp.
Syntax
New-ConsoleTextInput
[-Disabled]
[[-Label] <String>]
[-MaxLength <Int32>]
[-Name] <String>
[-OnChange <ScriptBlock>]
[-Placeholder <String>]
[-TabIndex <Int32>]
[-Value <String>]
[<CommonParameters>]#Parameter set:
All Parameter SetsDescription
Emits a stable core TextInput widget. Place inputs in the outer layout, outside dependent bindings. The final state contains the input's committed value.
Examples
Example 1
New-ConsoleTextInput -Name Query -Placeholder 'Filter' -OnChange { $State.Edits = 1 + $State.Edits }Create an application input.
Parameters
- -Disabled SwitchParameter
- Disables editing and removes the input from keyboard focus traversal.
- -Label String
- Visible label; defaults to the name using the core control's labels.
- -MaxLength Int32
- Maximum text length in UTF-16 units.
- -Name String
- Unique key in the application's state and final hashtable.
- -OnChange ScriptBlock
- Runs once per committed edit on the owning input thread. Receives param($Value, $State) and injected $Value, $State and $Control. State is a hashtable; add or assign keys to write back. Output is discarded. Retains closure variables.
- -Placeholder String
- Muted hint while the value is empty.
- -TabIndex Int32
- Keyboard focus order. Equal values preserve layout declaration order.
- -Value String
- Initial text; empty by default.
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.