Skip to main content
8-Gravel
June 8, 2021
Question

How to change Text or Color Button by Service

  • June 8, 2021
  • 2 replies
  • 1281 views

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

16-Pearl
June 8, 2021

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

12-Amethyst
August 20, 2021

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