Skip to content
ConsoleMonster
Cmdlet

New-ConsoleButton

Module
ConsoleMonster
Inputs
None
Outputs
ConsoleMonster.Interactive.Button

Creates a named action button for Show-ConsoleApp.

Syntax

New-ConsoleButton
[-Disabled]
[[-Label] <String>]
[-Name] <String>
[-OnChange <ScriptBlock>]
[-OnClick <ScriptBlock>]
[-TabIndex <Int32>]
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Emits a stable core Button widget. Place inputs in the outer layout, outside dependent bindings. The final state contains the input's committed value.

Examples

Example 1

New-ConsoleButton -Name Apply -OnClick { $State.Applied = $true }

Create an application input.

Parameters

-Disabled SwitchParameter optional
Disables editing and removes the input from keyboard focus traversal.
-Label String optionalposition: 1
Visible label; defaults to the name using the core control's labels.
-Name String requiredposition: 0
Unique key in the application's state and final hashtable.
-OnChange ScriptBlock optional
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.
-OnClick ScriptBlock optional
Runs once per activation on the owning input thread. Receives param($Value, $State) and injected $Value, $State and $Control; Value is the activation count. Output is discarded.
-TabIndex Int32 optional
Keyboard focus order. Equal values preserve layout declaration order.

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.