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 / Onselect within Component
Power Apps
Answered

Onselect within Component

(0) ShareShare
ReportReport
Posted on by 156

I feel like this should be extremely easy but im struggling to work it out. 

 

Ive created a component. Within the component is an icon control that I want to switch between two different icon images each time it is clicked. Its basically a toggle. 


If I was doing this outside of a component I'd create a context variable that would be flipped between true or false with each icon onselect(), and have the icon shown be based on the current value of that context variable.  How can I achieve the same in a component, considering context variables aren't allowed within them?

 

I feel like I need to be creating a property for the component but i just dont know which one, or how to update it through the icon being selected. 

Categories:
I have the same question (0)
  • Verified answer
    Michael E. Gernaey Profile Picture
    53,968 Moderator on at

    Hi @philjn77 

     

    If you are only changing the value inside the component just use Set statement to create a variable.

    If you haven't turned on App Scope, then the variable is similar to a context as its only usable in the Component. If you turned on App scope, then you will see it everywhere.


    If you like my answer, I would really appreciate if you please Mark it as Resolved, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 325 Most Valuable Professional

#2
11manish Profile Picture

11manish 165

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 88 Super User 2026 Season 1

Last 30 days Overall leaderboard