Text required to be filled before Submit bottom can be pressed?


Ive seen some dashbords/forms with text feilds that needs to be filled before the Submit bottom becomes pressable.
How is that made?

below is an example.

New-UDForm -Content {

         New-UDRow -Columns {
            New-UDTextbox -Id 'textboxid' -Label 'textbox' -Placeholder 'textbox'
 } -OnValidate { 
 if ($EventData.textboxid -eq $null) {

        New-UDFormValidationResult -ValidationError "Text Required"

    } else {
        $TextBox1 = $True      
 if ($TextBox1)
         New-UDFormValidationResult -Valid
} -OnSubmit {

    New-UDTypography -Text $EventData.textboxid
   # your code