web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Button Colour When Sel...
Power Apps
Answered

Button Colour When Selected

(0) ShareShare
ReportReport
Posted on by 147

Hi,

 

I have two buttons that i am using to filter a gallery. They are Day Vs Night, so when one is clicked, it updates the filter to be for records for the day, and the night one changes it to night records.

 

How can I make it so that when one is selected this one's fill colour is different, so to highlight that this one is selected, and then when the other button is picked, it reverts back to Normal and the new one that has been selected is now highlighted?

 

Thanks

Categories:
  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @atray13 

    You would use a context variable to determine the color of the button as follows setting the OnSelect property of the button to: 

     

     

    UpdateContext({var:true}) and the other to UpdateContext({var:false})

     

     

    and set the Fill property of the button to If(var,Red,Blue) .  You would set the OnVisible property of the screen to whichever default you wanted using the UpdateContext() function: UpdateContext({var:true})

  • Verified answer
    KrishnaV Profile Picture
    5,023 on at

    Hi @atray13 ,

     

    Do this:

     

    UpdateContext({varBtnDayFillColor:RGBA(250, 255, 178, 1),varBtnNightFillColor:RGBA(56, 255, 178, 1)})

     

    Set this formula on both the buttons and set the Fill property as varBtnDayFillColor for Day and  varBtnNightFillColor for night button.

     

    Note: Please change RGBA colors as per your styles, what I gave you here is a sample.

     

    See the below working model:
    buttonFill.gif


    I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

    Regards,
    Krishna
    If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

  • atray13 Profile Picture
    147 on at
    Great thank you

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 194 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 150

Last 30 days Overall leaderboard