Cmdlet
New-ConsoleToggle
Creates a named Boolean toggle for Show-ConsoleApp.
Syntax
New-ConsoleToggle
[-Disabled]
[[-Label] <String>]
[-Name] <String>
[-OnChange <ScriptBlock>]
[-TabIndex <Int32>]
[-Value <Boolean>]
[<CommonParameters>]#Parameter set:
All Parameter SetsDescription
Emits a stable core Toggle widget. Place inputs in the outer layout, outside dependent bindings. The final state contains the input's committed value.
Examples
Example 1
New-ConsoleToggle -Name Enabled -Label 'Enable checks' -Value $trueCreate 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.
- -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.
- -TabIndex Int32
- Keyboard focus order. Equal values preserve layout declaration order.
- -Value Boolean
- Initial Boolean value; false 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.