New-UDIcon -onclick

Product: PowerShell Universal
Version: 3.5.5

How would i get an icon to be clickable? is there a secret way to put the onclick handler on the element?

You can wrap any component with new-udelement and add an onclick handler.

New-UDElement -Tag div -Content {
   New-UDIcon -Icon "user"
} -Attributes @{
    onClick = {
          Show-UDToast "Nice!"
     }
}
1 Like
Start-BrainCramp -Name 'Omzig'
Start-Sleep 'endless'
End-BrainCramp -Name 'Omzig'

@adam,

Can you add a documentation section for adding events to elements?

Example:

Adding Events

You can wrap any component with New-UDElement and add an onclick handler.

New-UDElement -Tag div -Content {
   New-UDIcon -Icon "user"
} -Attributes @{
    onClick = {
          Show-UDToast "Nice!"
     }
}

PR Created: Add event handler documentation. by Omzig · Pull Request #46 · ironmansoftware/universal-docs · GitHub