Skip to main content
Jun 8, 2021 8:27 AM UTC
Question

How to change Text or Color Button by Service

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?

NK_9909348_0-1623140766574.png

2 replies

Jun 8, 2021 11:36 AM UTC

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

Aug 20, 2021 8:33 AM UTC

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