Power Apps Button Control [How to Use]

In this Microsoft Power Apps tutorial, we will learn everything about Power Apps Button Control and its key properties.

Also, we will discuss how to add and customize the Power Apps Button control in a Canvas app with various examples.

Also, Read: Power Apps Modern Button Control [Complete Guide]

Power Apps Button Control

Power Apps Button Control allows users to perform an action on its onclick. That indicates that when a user clicks the button, something will happen.

The below image represents the Power Apps button control:

Power Apps Button Control
Power Apps Button Control

Power Apps Button Control Properties

Let’s discuss the Key properties of Power Apps Button control in a Canvas app such as:

PropertyDescription
TextWe can change the name of the Button control in the Text property
DisplayModeBy default in Edit mode, if we want to change to Disable mode where we will not
DisabledColorThe distance between the Button control’s left & right edges
ColorBy using the color property, we can define the text color, and background color and also change border thickness & color as well
BorderColorColor of the Button control’s border
BorderStyleSelect the Border styles like Solid, Dashed, Dotted, or None
Fontwe can also change the font, font size, and font style. And also we get other properties to Button control
FillTo fill the Background color of a Button control
DisabledColorDisabled the Color of text in the DisplayMode property of the Button control
HoverFillChange the background color of the Button control
OnSelectWhen the user clicks or taps the Button to perform the actions
PaddingWe can add padding around the text of the Button
PressedColorChange the Color of text, when the user Clicks or Taps the Button control
PressedFillChange the Color of the Button control, when the user Clicks or Taps the Button control
SizeTo change the size of the button by using drag & drop the button or change the width & height positions
VisibleSelect the Visible slide option to show/hide the Button or change the Visible property.
WidthThe distance between the Button control’s left & right widges
XThe distance between the left edge of the control and to left edge of its parent container
YThe distance between the top edge of the control and to top edge of its parent container
Key properties of Power Apps Button control

See the below picture that explores key properties of the Power Apps Button control. Also, we can add more button properties from the top left corner.

How to get Key properties of the Power Apps Button control
How to get Key properties of the Power Apps Button control

This is all about Power Apps Button Control Properties.

Add Power Apps Button Control

Here, we will see how we can add a Power Apps Button Control in the Power Apps Canvas app.

  • To add a Button in Power Apps, Go to + Insert -> Click the Button control.
Microsoft Power Apps Button Control
Microsoft Power Apps Button Control
  • Once it will appear, we will Rename the Button control (btn-saved) and Change the Text property (“Click to View Text Box”) as shown below:
Power Apps Button Control in a Canvas App
Power Apps Button Control in a Canvas App

This is how to add a Power Apps Button Control in the Canvas app.

Check out: How to Show Hide Power Apps Label Control On Button Click

How to Use Power Apps Button Control

Let’s take a simple scenario that how we can work with Power Apps Button Control.

  • The below image represents a Power Apps Button control (Click to View Text Box) and a Text input control.
  • When a user will click on the button, then the text box will appear (right side) where you can enter any text. Again when the user will click on the button, then the text input control will disappear.
how to display Power Apps Text input control on the Button click
How to display Power Apps Text input control on the Button click
  • To work around this, select the Button control and set its OnSelect property to the code below:
OnSelect = UpdateContext({showTextField: !showTextField})

Where,

showTextField = Context variable name

How to Use Power Apps Button Control
How to Use Power Apps Button Control
  • Next, select the text input control and set its Visible property as:
Visible  = showTextField

ShowTextField is the context variable name.

How to Use Power Apps Button Control in the Canvas App
How to Use Power Apps Button Control in the Canvas App

Finally, Save, Publish, and Preview the app. Once you will click on the button control, the text input control will appear at the same time. When the user will click the button again, then the text input will disappear.

This is how to Use Power Apps Button Control.

Power Apps Button Control Customization

Now, we will see how to Customize a Power Apps Button Control in the Canvas app like:

  1. Change the Power Apps Button appearance
  2. Change Power Apps button color when hovering over it
  3. How to disable the Power Apps Button control
  4. Power Apps Button Control in View Mode

Change the Power Apps Button appearance

By default, we get Rectangular button control with rounded corners in a Canvas app. Instead of that, we can change the Button control shape by using the following properties like Height, Width, and Radius.

For suppose, we have to create a Button shape either a Square or Circle. For this follow the steps are:

  • Insert the New button control to make a Square shape -> Go to the Properties pane, change the width and height property as the same size, and make it the Border radius value as below:
Width = 160
Height = 160
Border radius = 0
Change the Button appearance
Change the Power Apps Button appearance
  • Also, we will see how to make a Power Apps Button control in a Circle shape. Insert a New button, and make the width and height property as the same size. Also, make it Border radius value as below:
Width = 160
Height = 160
Border radius = 80
How to change the Button appearance
How to change the Power Apps Button appearance
  • We can also get Duplicate Power Apps button controls by using the original buttons. For this, we can just Copy (Ctrl+C) and Paste (Ctrl+V) the respective button controls like below:
How to change the Button appearance in a Canvas app
How to change the Power Apps Button appearance in a Canvas app

This is how to change the Power Apps Button appearance in a Canvas app.

Have a look: Power Apps Modern Text input Control [All in Detail]

Change Power Apps button color when hovering over it

Let’s see how to change the button color when we hover over it. By default, the fill color of the button control will dim by 20%. But we can change it by using the HoverFill property like below:

HoverFill = ColorFade(RGBA(56, 96, 178, 1), 10%)
How to change a button's color when hovering over it
How to change a button’s color when hovering over it

Also, we can change the complete color (BlueViolet) by using the PressedFill property like below:

PressedFill = BlueViolet
Change a button's color when hovering over it
Change a button’s color when hovering over it

Follow the below picture that shows how we get another color when we hover over the Power Apps button control:

how we get another color when we hover over the button control
how to get another color when we hover over the button control

This is how to change a Power Apps button color when hovering over it in a Canvas app.

How to disable Power Apps Button Control

Here, we will see how to disable the Button control in the Canvas app. That means it will be clicked only once by the user. Let’s follow the below steps to disable the Button control such as:

  • Click on the Button control (Click me). And set its OnSelect property to the code below:
OnSelect = UpdateContext({buttonDisplayMode:DisplayMode.Disabled})

Where,

buttonDisplayMode = Context variable name

How to disable the Power Apps Button control
How to disable the Power Apps Button control
  • Next, go to the DisplayMode property and set the context variable as:
DisplayMode = buttonDisplayMode
How to disable the Power Apps Button control in the Canvas app
How to disable the Power Apps Button control in the Canvas app

buttonDisplayMode is the context variable name.

  • When a user will tap on the Click me button, then the button will disable mode.
How to disable the Button control in the Canvas App
How to disable the Power Apps Button control in the Canvas App
  • Similarly, we can easily disable the Button control in the Canvas app without using any formula. Here, we can go to the Button control Properties pane -> Select Disabled under the Display mode property as shown below.
How to get disable option in the Canvas app
How to get Disable Option in the Canvas app

This is how to disable the Power Apps Button control in the Canvas app.

Power Apps Button Control in View Mode

Next, we will see how to only View the Button control in the Canvas app. That means a user can only view the Button control. They should not edit the button control. For that, we have to follow below steps are:

  • Click on the Button control -> Go to the Property pane -> Select View mode in Display mode property.
View the Button control in a Canvas App
View the Power Apps Button control in a Canvas App
  • Instead of that, we can follow another way (With the DisplayMode Property) to View the Button Control in a Canvas app. Just follow the below steps are:
  • Click on the Button control (Click me), and set its DisplayMode property to the code below:
DisplayMode = DisplayMode.View
How to get view button control in a Power Apps
How to get view button control in a Power Apps

This is how to view the Power apps Button control in a Canvas app.

Additionally, you may like some more Power Apps and SharePoint tutorials:

Conclusion

From this Microsoft Power Apps tutorial, we learned Power Apps Button Control and its key properties. And also covered how to add and customize the Power Apps Button control in a Canvas app like:

  • Change the Power Apps Button appearance
  • Change Power Apps button color when hovering over it
  • How to disable the Power Apps Button control
  • Power Apps Button Control in View Mode