cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

How to change Text or Color Button by Service

Nguyen_Khue
8-Gravel

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 2

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

Announcements


Top Tags