Microsoft Power Apps announced a new feature called Code View which allows developers to see and edit the underlying code behind their apps. This feature is especially useful for those who have a background in coding and prefer to work directly with the code for more precision and control.
Developers can now view and use the source code, in readable YAML + Power Fx format.
YAML (YAML Ain't Markup Language) is a human-readable data serialization language for all programming languages.
Example: A YAML code of a button in a canvas app looks like this.
![](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fb12emk2u1cga%2F4YYLbvJBqp5is7h74PpSW5%2Fb4985758aca1e20ddad680c464d98c7b%2Fc1.png&w=1080&q=75)
Let’s see how we can use the code view feature in power apps.
Firstly, Log in to Power Apps.
Click on any Canvas App to edit.
![](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fb12emk2u1cga%2F2Og2mdG744CBlJaFZRKYSj%2F03a070bac2f0a836724d7faf22ed50e2%2Fc2.png&w=3840&q=75)
Add a button to the screen.
![](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fb12emk2u1cga%2F67BmxeOaovMADNltbVHFlV%2Feed428dd533e7abb94043ea7be319536%2Fc3.png&w=3840&q=75)
Now, right-click on the button to see different options. Here, click on View Code (Preview).
![](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fb12emk2u1cga%2F7ACXRJov68xotyCgxdLqYo%2F810477e020e990ee5eba598a929d626d%2Fc4.png&w=3840&q=75)
This is what the YAML code of a simple button looks like. Copy this code and paste it into an editor or Note pad to make your preferred changes.
![](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fb12emk2u1cga%2F6gHM9Jpi1lvtwRopvDL1nC%2Fa3d9891475345fc40ab139ece40574ba%2Fc5.png&w=3840&q=75)
After making the changes, copy the edited YAML code
![](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fb12emk2u1cga%2F5Pz3XESFdJwyvtA3KDRuMi%2F8e2bb36878f0b27a80999178b047b014%2Fc6.png&w=2048&q=75)
Above is the YAML code for a button with a Text property set to "Click Me." When you apply this code in the Power Apps Code View, it will update the button's displayed text to "Click Me.”
Go back to Power Apps. Right-click on the button and select Paste code(preview).
![](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fb12emk2u1cga%2F61o8YKkeryfMV5DsqhOanP%2F574e46f70200b1d4874198bffadd8a7f%2Fc7.png&w=3840&q=75)
Now you can see it created a new Button with the name Click me on it.
![](/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fb12emk2u1cga%2FLgObXTRetlEY8NbjRCJnE%2Ff47821ac94f35acb23fab94bf26ec153%2Fc8.png&w=3840&q=75)
The new Code View feature in Microsoft Power Apps enhances developer experience by allowing direct access to the underlying code in a readable YAML + Power Fx format. This feature is ideal for those with coding backgrounds, offering greater precision and control over app customization. By following simple steps to view, edit, and paste code, developers can efficiently make changes and create more robust applications.
Frequently Asked Questions (FAQs):
1. What is the Code View feature in Power Apps?
The Code View feature allows developers to view and edit the underlying code of their apps in a readable YAML + Power Fx format.
2. How do I access the Code View in Power Apps?
Log in to Power Apps, select a Canvas App to edit, add a button to the screen, right-click on the button, and click on "View Code (Preview)".
3. Can I edit the properties of a button using the Code View feature?
Yes, you can edit various properties of a button, such as position, size, text, and colors, directly in the YAML code.
4. Can I revert changes made through the Code View?
Yes, if the changes do not produce the desired outcome, you can revert them by editing the code again or using the app's version control features.