Custom UI Button and Container in Power Apps Using HTML Code

Published Feb 07 2022 04:20 AM 2,649 Views
Senior Member

In this blog, we will learn how to create an awesome UI button to take position of the default button in Power Apps. This will be done using an HTML code. 

custom_UI_Button.jpg

 

Let's create a new blank canvas app to begin. If new to power apps, check this out on the Microsoft Learn site.
This will be done in a few steps.

 

1. Click on the Insert tab ---> Text ---> HTML text

2. In the HtmlText, clear the default code and input the below. 

Generate your pereferred gradient color code using the CSS Gradient generator.

 

 

"<div style='background: linear-gradient(90deg, rgba(12,204,237,1) 0%, rgba(15,252,224,1) 100%); 
box-shadow: 1px 2px 22px 0px rgba(89,87,87,0.85);
margin: 20px; 
width: 290px; 
height: 80px; 
border-radius: 30px'>
</div>"

 

 

 

The final code and preview should look like this.

htmltextbutton.jpg

 

3. Create a button. Insert tab ---> Button

Place the button on the HTML text container. Resize the button to fit on it and change the following properties as below.

 

htmltextbutton1.jpg

 

  • Text - Change to your preferred. Here, it's a "Sign In" button.
  • Color - Change the color to transparent. That is RGBA(0, 0, 0, 0) as shown.

htmltextbutton2.jpg

  • Border - Click the border line and select None from the dropped down options.

You can make configuration to your button OnSelect even after setting up the properties making it transparent.

 

5. Finally, we will create a container to hold the button by following step 1 and 2 with a little change in the code to make the container transparent. The width and the height should also be adjusted.

 

 

"<div style='background-color: rgba(0,0,0,0); 
box-shadow: 1px 2px 22px 0px rgba(89,87,87,0.85); 
margin: 20px; 
width: 500px; 
height: 600px; 
border-radius: 30px'>
</div>"

 

 

 

6. Move the button into the container then Right-click the container ---> Reorder ---> Send to back (this will enable you to be able to work on the button without the container interfering) 

htmltextbutton6.jpg

 

Summary

We learnt how to create customized button using the HTML Text in Power Apps studio with a gradient color and added a default button which was made to appear transparently on top of the customized container. Then created another container which the sizes and color was adjusted to be able to contain other objects.

Final look at the customized UI button and container.

htmltextbutton_final.jpg

 

 

Resources to get you started and keep going!

Free Microsoft 365 E5 instant sandbox

Get started with Power Apps canvas apps

Button control in Power Apps

 

 

 

%3CLINGO-SUB%20id%3D%22lingo-sub-3119811%22%20slang%3D%22en-US%22%3ECustom%20UI%20Button%20and%20Container%20in%20Power%20Apps%20Using%20HTML%20Code%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3119811%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20this%20blog%2C%20we%20will%20learn%20how%20to%20create%20an%20awesome%20UI%20button%20to%20take%20position%20of%20the%20default%20button%20in%20Power%20Apps.%20This%20will%20be%20done%20using%20an%20HTML%20code.%26nbsp%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELet's%20create%20a%20new%20blank%20canvas%20app%20to%20begin.%20If%20new%20to%20power%20apps%2C%20check%20this%20out%20on%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Flearn%2Fmodules%2Fget-started-with-powerapps%3FWT.mc_id%3Dacademic-56816-leestott%22%20rel%3D%22noopener%20noreferrer%22%20target%3D%22_blank%22%3EMicrosoft%20Learn%3C%2FA%3E%20site.%3CBR%20%2F%3EThis%20will%20be%20done%20in%20a%20few%20steps.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1.%20Click%20on%20the%20Insert%20tab%20---%26gt%3B%20Text%20---%26gt%3B%20HTML%20text%3C%2FP%3E%3CP%3E2.%20In%20the%26nbsp%3BHtmlText%2C%20clear%20the%20default%20code%20and%20input%20the%20below.%26nbsp%3B%3C%2FP%3E%3CP%3EGenerate%20your%20pereferred%20gradient%20color%20code%20using%20the%20%3CA%20href%3D%22https%3A%2F%2Fcssgradient.io%2F%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3ECSS%20Gradient%3C%2FA%3E%20generator.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%22%3CDIV%20style%3D%22'background%3A%22%20linear-gradient%3D%22%22%3E%20%3C%2FDIV%3E%22%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20final%20code%20and%20preview%20should%20look%20like%20this.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E3.%20Create%20a%20button.%20Insert%20tab%20---%26gt%3B%20Button%3C%2FP%3E%3CP%3EPlace%20the%20button%20on%20the%20HTML%20text%20container.%20Resize%20the%20button%20to%20fit%20on%20it%20and%20change%20the%20following%20properties%20as%20below.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3EText%20-%20Change%20to%20your%20preferred.%20Here%2C%20it's%20a%20%22Sign%20In%22%20button.%20Color%20-%20Change%20the%20color%20to%20transparent.%20That%20is%20RGBA(0%2C%200%2C%200%2C%200)%20as%20shown.%3CP%3E%3C%2FP%3EBorder%20-%20Click%20the%20border%20line%20and%20select%20None%20from%20the%20dropped%20down%20options.%3CP%3EYou%20can%20make%20configuration%20to%20your%20button%20OnSelect%20even%20after%20setting%20up%20the%20properties%20making%20it%20transparent.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E5.%20Finally%2C%20we%20will%20create%20a%20container%20to%20hold%20the%20button%20by%20following%20step%201%20and%202%20with%20a%20little%20change%20in%20the%20code%20to%20make%20the%20container%20transparent.%20The%20width%20and%20the%20height%20should%20also%20be%20adjusted.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%22%3CDIV%20style%3D%22'background-color%3A%22%20rgba%3D%22%22%3E%20%3C%2FDIV%3E%22%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E6.%20Move%20the%20button%20into%20the%20container%20then%20Right-click%20the%20container%20---%26gt%3B%20Reorder%20---%26gt%3B%20Send%20to%20back%26nbsp%3B(this%20will%20enable%20you%20to%20be%20able%20to%20work%20on%20the%20button%20without%20the%20container%20interfering)%26nbsp%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESummary%3C%2FP%3E%3CP%3EWe%20learnt%20how%20to%20create%20customized%20button%20using%20the%20HTML%20Text%20in%20Power%20Apps%20studio%20with%20a%20gradient%20color%20and%20added%20a%20default%20button%20which%20was%20made%20to%20appear%20transparently%20on%20top%20of%20the%20customized%20container.%20Then%20created%20another%20container%20which%20the%20sizes%20and%20color%20was%20adjusted%20to%20be%20able%20to%20contain%20other%20objects.%3C%2FP%3E%3CP%3EFinal%20look%20at%20the%20customized%20UI%20button%20and%20container.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EResources%20to%20get%20you%20started%20and%20keep%20going!%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdeveloper.microsoft.com%2Fmicrosoft-365%2Fdev-program%3FWT.mc_id%3Dacademic-56816-leestott%22%20rel%3D%22noopener%20noreferrer%22%20target%3D%22_blank%22%3EFree%20Microsoft%20365%20E5%20instant%20sandbox%3C%2FA%3E%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Flearn%2Fmodules%2Fget-started-with-powerapps%3FWT.mc_id%3Dacademic-56816-leestott%22%20rel%3D%22noopener%20noreferrer%22%20target%3D%22_blank%22%3EGet%20started%20with%20Power%20Apps%20canvas%20apps%3C%2FA%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowerapps%2Fmaker%2Fcanvas-apps%2Fcontrols%2Fcontrol-button%3FWT.mc_id%3Dacademic-56816-leestott%22%20rel%3D%22noopener%20noreferrer%22%20target%3D%22_blank%22%3EButton%20control%20in%20Power%20Apps%3C%2FA%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-3119811%22%20slang%3D%22en-US%22%3E%3CP%3E%3C%2FP%3E%3CP%3EUsing%20HTML%20text%20to%20create%20awesome%20and%20stylish%20UI%20button%20and%20container%20to%20replace%20the%20default%20button%20experience.%20The%20frequent%20question%20from%20most%20upcoming%20Power%20Apps%20developers%20is%2C%20how%20to%20make%20a%20cutomised%20and%20stylished%20user%20interface%20(UI).%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3119811%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ELearn%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Elearning%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ELow%20Code%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPower%20Apps%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPower%20Platform%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EStudent%20Learn%20Ambassadors%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EStudents%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Co-Authors
Version history
Last update:
‎Feb 07 2022 04:20 AM
Updated by: