Switch label option

Hey Adam,

What’s the best way to add a label to a switch input?

Thanks

Hello @SnV although I am not the mighty @adam my first name is still Adam. So just curious if you want something like:-

I mean you could do some CSS for RED is off and GREEN is on…you could do a toast message to say what the current state is, or I mean you could even nest a bit of HTML to change to ON and OFF when the switch input is changed…there is 4 ideas for you to choose from :slight_smile:

But you are also just as Mighty!!!

This might work. I was really just looking for a way to put a label next to the switch to say what it is there for in the dynamic form I am building. dont need any changing when its switched. But I think I can probably use something from this to make it work.

New-UDHtml -Markup

This is exactly what I needed.

Thanks

1 Like

Using the New-UDHTML how do I change the color of the text? did not work for me.

thanks

Hello @SnV if you want to change the color of the text, you should be able to do this if you wrap it in udhelmet…an example using this is here on my blog

Hope this helps

Thanks, it does but I want to change the color depending on the result of the task running. Maybe I should use the UDelement for this.

Do you have any idea on this post of mine? Table manipulation

I would probably use a get-udelement on the ID of the switch in an endpoint, and get the attribute for the value of it. Then you could use an IF condition to set the text and text colour, depending on the value of the given switch…as for your other question…I have seen it but as I do not yet use PU I do not have access to the new cmdlets your using so I cannot replicate the issue.
If you need a demo of the switch how I would do it let me know :slight_smile: