Tried some other things, decided to wrap the button itself into a New-UdDynamic, since I am still working under the impression that long running processes should be there. Came up with this that does work under that idea.
New-UDDashboard -Title 'PowerShell Web' -Content {
New-UDElement -Tag 'div' -Id 'myElement' -Content {}
New-UDdynamic -content {
New-UDButton -Text 'Click Me' -OnClick {
Set-UDElement -Id 'myElement' -Content {
New-UDProgress -Circular -ProgressColor Red
}
start-sleep -Seconds 5
Set-UDElement -Id 'myElement' -Content {
New-UDTypography -Text "Complete" -Style @{ color = 'green' }
}
}
}
}
I will integrate it into my original dashboard tomorrow. This is at least progress.
**EDIT - Tested wonderfully, I marked this as solution.
And I want to thank @Jori for the initial explanation of how/why/when to use New-UDDynamic from another post I had.