Disable Button in Modal -Footer

Hi,

How can I disable a button that is within the -Footer of a Modal based off an if statement? For example:

Show-UDModal -Content{

               if($username.length -gt 21){
				$usernameStatus = New-UDTypography -Text ("Username: " + $username + " 
                                 exceeds 20 characters!") -Style @{ color = "#FF0000" } -Variant body1
			}

                New-UDTypography -Text 'Summary:' -Style @{ color = "#05a0a1" } -Variant h5
                $usernameStatus


        } -Footer {

            New-UDButton -Id 'btnBack' -Icon (New-UDIcon -Icon ArrowLeft) -Variant 'outlined' -Text "Back" -Style @{color = "#05a0a1"} -OnClick { Hide-UDModal }

            New-UDButton -Id 'btnCreate' -Icon (New-UDIcon -Icon UserPlus) -Variant 'outlined' -Text "Create" -Style @{color = "#05a0a1"} -OnClick {}

Thanks

Here’s an example of a button that pops a modal with buttons that disable other buttons. :smiley:

New-UDDashboard -Title "Hello, World!" -Content {

  New-UDButton -Text 'click' -OnClick {

      Show-UDModal -Content{

          New-UDBUtton -Text 'Disable Button' -OnClick {

            Set-UDElement -Id 'btnCreate' -Properties @{ disabled = $true }

          }

        } -Footer {

            New-UDButton -Id 'btnBack' -Icon (New-UDIcon -Icon ArrowLeft) -Variant 'outlined' -Text "Back" -Style @{color = "#05a0a1"} -OnClick { Hide-UDModal }

            New-UDButton -Id 'btnCreate' -Icon (New-UDIcon -Icon UserPlus) -Variant 'outlined' -Text "Create" -Style @{color = "#05a0a1"} -OnClick {}

        }

  }

} 
1 Like