Textbox component for Universal Dashboard

A textbox lets users enter and edit text.


New-UDTextbox -Label 'Standard' -Placeholder 'Textbox'
New-UDTextbox -Label 'Disabled' -Placeholder 'Textbox' -Disabled
New-UDTextbox -Label 'Textbox' -Value 'With value'

Password Textbox

A password textbox will mask the input.

New-UDTextbox -Label 'Password' -Type password


You can create a multiline textbox by using the -Multiline parameter. Pressing enter will add a new line. You can define the number of rows and the max number of rows using -Rows and -RowsMax.

New-UDTextbox -Multiline -Rows 4 -RowsMax 10


Retrieving a textbox value

You can use Get-UDElement to get the value of a textbox

New-UDTextbox -Id 'txtExample' 
New-UDButton -OnClick {
    $Value = (Get-UDElement -Id 'txtExample').value 
    Show-UDToast -Message $Value
} -Text "Get textbox value"

Setting the textbox value

New-UDTextbox -Id 'txtExample' -Label 'Label' -Value 'Value'

New-UDButton -OnClick {

    Set-UDElement -Id 'txtExample' -Properties @{
        Value = "test123"

} -Text "Get textbox value"


You can set the icon of a textbox by using the -Icon parameter and the New-UDIcon cmdlet.

New-UDTextbox -Id "ServerGroups" -Icon (New-UDIcon -Icon 'server') -Value "This is my server"


You can define a text mask with a combination of strings and regular expressions. To specify a regular expression, use the JavaScript syntax in your string to start and finish the expression: /\d/.

This example creates a mask for US based phone numbers.

New-UDTextbox -Mask @('+', '1', ' ', '(', '/[1-9]/', '/\d/', '/\d/', ')', ' ', '/\d/', '/\d/', '/\d/', '-', '/\d/', '/\d/', '/\d/', '/\d/')


Available in PowerShell Universal 2.9 or later.

The -OnEnter event handler is executed when the user presses enter in the text field. It is useful for performing other actions, like clicking a button, on enter.

New-UDTextbox -OnEnter {
    Invoke-UDEndpoint -Id 'submit'

New-UDButton -Id 'submit' -OnClick {
    Show-UDToast -Message 'From Textbox'



Last updated