Table Of Contents:
• Screen Names
• Control Names
• Variable Names
• Collection Names
• Datasource Table Names
Screen Names
A screen name should clearly describe its purpose in 2-3 words ending with word “Screen.” Use proper-case. A screen-reader will speak the screen name to visually-impaired users when the screen loads.
Good Examples | Bad Examples | Bad Reason |
Appointments Screen | Appointments | Missing the word ‘Screen’ |
Order Form Screen | OrderFormScreen | Not friendly to a screen reader |
Collect Signature Screen | scrCollectSignature | Not friendly to a screen reader |
Control Names
A control name should show the control-type, the purpose and the screen. Use camel-case and underscores for spacing. For example, the control named txt_OrderForm_FirstName is a text input that captures first name on the app’s Order Form Screen.
Good Examples | Bad Examples | Bad Reason |
drp_NewEmployee_Department | drpDepartmentNewEmployee | No spacing |
btn_OrderForm_Submit | btn_Submit_OrderForm | Wrong order |
gal_Home_Appointments | gly_Home Appointments | Non-standard control prefix |
A list of standard control prefixes can be found below.
Control | Prefix |
3D Object | 3do |
Add Picture | pic |
Address Input | add |
Audio | aud |
Barcode Scanner | bar |
Button | btn |
Camera Control | cam |
Canvas | cvs |
Card | dtc |
Charts | chr |
Check Box | chk |
Collection | col |
Container | con |
Combo Box | cmb |
Component | cmp |
Date Picker | dte |
Drop Down | drp |
Export | exp |
Form | frm |
Gallery | gal |
Group | grp |
HTML Text | htm |
Icon | ico |
Image | img |
Import | imp |
Label | lbl |
List Box | lst |
Map | map |
Measuring Camera | mcm |
Microphone | mic |
Microsoft Stream | str |
PDF Viewer | |
Pen Input | pen |
Power BI Tile | pbi |
Radio | rad |
Rating | rtg |
Rich Text Editor | rte |
Shapes | shp |
Slider | sld |
Table | tbl |
Text Input | txt |
Timer | tmr |
Toggle | tgl |
Video | vid |
Variable Names
A variable name should show the scope of the variable and its purpose. Use camel-case with no spaces between each word. For example, the variable gblUserEmail is a global variable which holds the current user’s email address.
Good Examples | Bad Examples | Bad Reason |
gblUserCurrent | UserCurrent | No scope |
locPacksInBoxQuantity | Loc_Packs_In_Box_Quantity | Improper capitalization and spacing |
LocIsLoading | locBoolLoading | Do not use data types in variable names |
varWorkdaysDuringVacation | varWorkdays | Not descriptive enough |
Collection Names
A collection name should contain the original datasource and describe its purpose. Use camel-case with no spaces between each word. For example, the collection colDvInvoices is a collection of invoices from Dataverse.
Good Examples | Bad Examples | Bad Reason |
colSpEmployees | colEmployees | No datasource |
colDvSalesLeads | coldv_salesleads | Improper capitalization and spacing |
colNavigationMenu | NavigationMenu | Do no use data types in variable names |
A standard list of datasource abbreviations can be found below:
Original Datasource | Abbreviation |
Dataverse | Dv |
SharePoint | Sp |
SQL | Sql |
Salesforce | Sf |
None (created in-app) | (none) |
Datasource Table Names
A datasource created by the developer should have 1-3 words to describe its purpose. Use the singluar form of the word and proper-case. Be as concise and clear about the purpose of the datasource as possible.
Good Examples | Bad Examples | Bad Reason |
Employee | Emp | Abbreviation instead of full word |
Construction Project | Projects | Too general, what type of projects? |
Repair Order | RepairOrders | No spacing, plural |
Did You Enjoy This Article? 😺
Subscribe to get new Power Apps articles sent to your inbox each week for FREE
Questions?
If you have any questions about Power Apps Standards: Naming Conventions please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.
Interesting read thank you, though little confused around your thoughts on data types in variable naming. As you say it should (which I totally agree with) but then ‘locBoolLoading’ is bad because it includes data type?
David,
That was a typo. Data type should not be included in the variable name.
Thanks for clarity, interesting choice not too. I like a structure of scope-type-description as easier for intellisense (as I can filter the variables down as I type)
I think I agree with David and your typo rather than you (unusually) Matthew. Variable types can vary so greatly (string, record, table etc.) that their type in their name assists readability imho. Be interested to know what you think is the downside.
Rex,
“A variable’s name should be independent of its type. You shouldn’t name your variables after their types for the same reason you wouldn’t name your pets “dog” or “cat”. You shouldn’t include the name of your type in the name of your variable for the same reason.”
Here’s the reasoning I agree with most:
https://dave.cheney.net/2019/01/29/you-shouldnt-name-your-variables-after-their-types-for-the-same-reason-you-wouldnt-name-your-pets-dog-or-cat
I think it’s hard to stand by that logic, when the other conventions are btn_OrderForm_Submit and colDvSalesLeads but I agree it’s easier to leave it out of variable names than controls (e.g. multiple cases like lblName, txtName).
I saw some MS document somewhere and found it very confusing – and hard to use. These instructions are much better. I will add this to my ressource collection 🙂
Reiner,
Thanks for the compliment! I remember you from LinkedIn 🙂
Hi Matthew, great work on the guide!
I’d like to propose a minor improvement for the control naming. I would add the control type as suffix. Then you have the order of the name parts by their relevance for most use cases.
A common scenario is to have a data field “FirstName”. Then on the form you have an input control for that field together with a label. If you use OrderForm_FirstName_txt and OrderForm_FirstName_lbl as control names you see on the first glance, that those two belong together. Especially if you order the controls on the screen/form by name.
Excellent guide, and site for that matter!
I’ve tried using the official whitepaper for some time and find it very useful. I notice that you have introduced an underscore after the prefix for control names, which is not the case in the official whitepaper, can you share the reasoning behind this convention?
Hjalmar,
I added an underscore after the prefix to clearly indicate which text refers to control type and which text refers to the screen name. I believe using an underscore makes it quicker to read and understand this.
I see your point on visibility, but I’m a bit worried that introducing another convention (snake_case combined with camelCase and or PascalCase) adds more complexity than what its worth. Another thing is that pascal, camel, snake (and so on) case are familiar convention patterns pro developers are familiar with, and that pro developers in fusion teams may find it a bit too unconventional 🙂
Do you have some experience to standard environment variable and connection reference in solution?
Eric,
I do, but I don’t have anything written written on it. This is more of an ALM topic so I kept it outside of this guide.
Great guide / standards.
I especially like the _ between segments. It keeps things visually clear and allows simple processing to extract if needed.
Why do you have controls using underscore between names, yet everything else is CamelCase with one word? It would seem to me that you’d want them all the same. Would the Variable be better started with var?
Lynn,
Using both underscores between names & CamelCase with one word has been a convention of this community for a long-time. I feel it is better to stick with some of the standard conventions laid down in the original Microsoft whitepaper with a few adjustments. In my humble opinion, doing this will increase the chances another developer experienced in the technology will be able to quickly understand my code.
No, I disagree variable is not better started with var. Variables are scoped in Power Apps. We need to know if the variable is globally or locally scoped.
I appreciate the thoughtful questions 🙂
I’m a non tech learner, already in the Microsoft Power Up program. Having challenges creating my first app. The major challenge is the function, controls and variables, making the icons I select do what is required. I need elaborate help, may be resources that can help me enter appropriate command functions. Really appreciate Mathew Devaney and co, for a nice job here.
Buse,
Congratulations on making it into the Power Up Program. I wish you well on your journey 🙂
Really appreciate. Thank you.
Great collection of standards!
Just a minor thing:
Regarding Datasource Table names you recommend using Singular form.
Shouldn’t it be “Construction Project” and “Repair Order”?
Thanks for delivering such good advice! 🙂
Kim,
Excellent attention to detail… thank you!!
With named formulas coming soon. What would you recommend as a naming conventions for it? Should it still be gbl?
Thank you and great advice!
Thien,
I use the prefix “fx”
fxColors = {
“themePrimary” = Color.Blue
}
could this be please added to the standard above?
i’ve stumbled onto some Power Apps youtubers who also use the “fx” prefix for named formulas, and that seems like a good idea, and it is also very common in Power BI functions to start them with “fx” also
Hi Matthew,
I’m a big fan of your work and really appreciate your contribution to the community. In my Power Apps projects, I often rely on your blog posts, they are brilliant.
I do have a suggestion for the “Naming Conventions”, especially for Control Names. In my humble opinion, it would be easier to follow the following order; control-type, the purpose and screen. Please let me explain my thoughts.
I’ve created a Power Apps Template (probably like many others) as an accelerator including a template screen. This way new screens can easily be created by duplicating it from this template screen. While duplicating this template the standard behavior of Power Apps is to add a suffix to all controls on the new screen e.g.: “_1”.
Let’s say my template is named “Template Screen” which has a control named “con_Template_MainContext”, the naming for the new controls on the new screen would be something like:
“con_Template_MainContext_1”
With 20 (or more) predefined controls on a template screen, you now must manually change all the control names, which is a tedious amount of work. Find/replace will be tricky because you don’t want to replace the screen name “_template_” of the original template screen itself and the controls on it.
Furthermore, you must use the find/replace twice, because you also have to remove the automatically added prefix “_1” for all the controls as well.
Following my suggested order like “con_MainContext_Template” you will get new control names like:
“con_MainContext_Template_1”
This makes it much easier to use the find/replace option; you just replace “_Template_1” with a new screen name like: “_ScreenName”.
In my experience it is also easier to read (find) the purpose of a control most left in the naming. Try reading the purpose of the controls in the picture. Do you notice that you skip the screen prefix part while scanning the controls?
In my opinion the suffix of the screen is less important, its main job is to stay out of conflict with duplicate names.
Is this something to consider changing in your guidelines?
Thanks in advance for your reply.
Martin,
Either way is fine so long as you are consistently applying to your apps. It just comes down to preference here. Search and replace tool makes any considerations about the ordering a moot point. Both can be changed equally fast.
could you please add the ‘Tab List’ modern control prefix into the above standard?
Hi I am a bit confused does this mean we add these after the publisher prefix?
Dome,
Add these to controls inside of Power Apps Studio.
Hello! I was just pointed to this from another post, and it’s a welcome replacement to the whitepaper, which was a good jumping off point but so many new controls were added, and the paper was never updated (Actually, recently it wasn’t even available at its old link). Many thanks!
I have a couple questions, which led me here in the first place:
DON’T use Prefix for your Names! We had this mess in the 90’s!
Use e.g UserGallery or IsAvailableCheckbox
Max,
The great thing about standards is everyone will have their own. Most important thing is to remain consistent.
I’m really interested of learning powerapps but I’m lack of programming understanding. I’m amazed of this app, so very helpful. I want to learn Matt, please help me.