User confirmation

I have a button
New-UDButton -Text ‘Anwenden’ -OnClick {

}
It seems quite simple but I don´t find an example how to add a user comfirmation like this in javascript before going on

if (confirm(“Go”)) {

} else {

}

Any help would be appreciated.

We don’t have a component for this specifically but you could use the modal to accomplish it.

    New-UDButton -Text "Do Something" -OnClick {
        Show-UDModal -Content {
            New-UDTypography -Text "Are you sure you want to do this?"
        } -Footer {
            New-UDButton -Text "Yes" -OnClick { 
                Show-UDToast "You did it!"
                Hide-UDModal 
            }
            New-UDButton -Text "No" -OnClick { Hide-UDModal }
        } -Persistent
    }
2 Likes

@Adam, Thank you a lot for the quick help!