Community Tip - You can change your system assigned username to something more personal in your community settings. X
Hi, I'm building my smart home. I want to click on Button, it will change color or text for 2 states. How can i do?
Hello @Nguyen_Khue
Please go through the following post to achieve your usecase
How-to-change-Label-and-Colour-of-button-dynamically
Please feel free to revert in case it doesn't resolve your query.
Thanks
Om Dukiya
Hi @Nguyen_Khue ,
There is a property on each visual widget called CustomClass. You can have your service output to it 2 different strings.
Your CSS should look something like this
.myFirstButton ptcs-button {
color: red !important;
background: yellow !important;
}
.mySecondButton ptcs-button {
color: yellow !important;
background: purple !important;
}
"myFirstButton" and "mySecondButton" being the 2 different strings you output from your service. ofc you can change them to whatever fits your context.
Good luck,
Gabriel