Visibility of components

Hi,

is it possible to hide components or make them visible when certain conditions are met?

best regards

You’ll have to use CSS:

New-UDElement -Id divElement -Attributes @{style = @{display = "block"}} -Content {
    "..."
}

# Check condition ...

# Hide the element ...
$attributes = (Get-UDElement -Id divElement).Attributes
if ($attributes.ContainsKey("style")) { $attributes.Remove("style") }
$attributes.Add("style", @{display = "none"})
# Setting the attribute overwrites existing attributes - that's the reason for the previous 3 lines ...
Set-UDElement -Id divElement -Attributes $attributes

You could wrap this in a function that you then pass to the EndPoint initilization so it can be reused in other endpoints and onclick / onchange events.

1 Like