Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to put code in a component ?



I have created this component with some buttons in it :



I have put this kind of code in the buttons : 

It doesn't seems to work, and the code I put generally in my components never work, this begs the question :
can we insert code in components or are they simply here for decorative purpose ?
Thanks for helping,
Super User III
Super User III


The formulas you use in your component are specific to your component, not to your app.

You cannot reference items within your app in your component.  

This is all because components are designed to be reusable in any app.  So, if you put a screen name in your component formulas to navigate to, that would be specific in your app and thus the component would not be reusable in another app as it would most likely not have that same screen.


In order to do this in an app, you need to set properties on the component with information from your app.

So, for example, if you wanted to have screen names to navigate to, you could supply a table of names to a custom property on your component - like ScreenIndexTable for example.


Set ScreenIndexTable to :  Table({ID:1, screen: screen1}, {ID:2, screen: screen2}) etc.

Then in your component, you can reference that table and navigate from it.

Example, if you had something displaying that related to ID 1, you could set the OnSelect of it 

Navigate(Lookup(myComponent.ScreenIndexTable, ID=1))


This is a VERY crude example which is simply to demonstrate that you need to provide app specific information to your component as your component cannot access anything specific about your app.


I hope this is helpful for you.





Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Super User III
Super User III


I think watching a video would be the most helpful thing here.   This is one by @BrianKnight shows how to add Navigate 'code' to the component.


Link to Youtube:


Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Not applicable

Hi @mdevaney @RandyHayes 


Thanks for answering, I have this problem when I try to create a custom property in my component, nothing shows up in the parameters, and it's the same thing if I want to edit it. I can't remove the custom property I created also.


Here is what it shows when I create a custom property :


@Anonymous're now the second person that I heard of this.  See this post.

Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Helpful resources

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.


Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (5,644)