Live training: next batches coming soon. Join the waitlist:Waitlists open:Developer Training →Developer →Copilot Studio Training →Copilot Studio →

Power Apps Disable Button

In this Power Apps article, I will explain what is a Button in Power Apps, how to disable button in Power Apps with various examples.

Also, I will discuss how you specify what happens when a user selects a button or control, and many more like:

  • PowerApps disable button after click
  • How to change button color on click in Power Apps
  • PowerApps Button Design

Power Apps Button Control

PowerApps Button is a type of input control that allows a user to tap on it to interact with the app. When a user clicks on the button, the app performs some action.

The image below represents how a Power Apps button looks like:

Power Apps Button

Power Apps Disable Button

To disable button in Power Apps, follow the examples below.

Example – 1:

  • I have a Power Apps Button named Hit Me. I would like to disable it after it’s been pressed once. Refer to the screenshot below.
PowerApps button disable
  • To achieve this, Select the Button control and set its OnSelect property:
OnSelect = UpdateContext ({ButtonDisplayMode: DisplayMode.Disabled})

Where,

ButtonDisplayMode = Context Variable name

Power Apps button disable
  • Next, go to the button’s DisplayMode property and apply the variable name that you have created.
DispayMode = ButtonDisplayMode
disable button powerapps
  • Save, Publish, and preview the app. Once we click the button [Hit Me], it will disable.

This is how to work with PowerApps disable button.

Example – 2:

  • There is a PowerApps Combo box control, a Label control, and a button. Here, the button will be in disable mode until and unless a user selects any value from the Combo box. Also, it will show a warning message like “Please select any option and click on the Next button“.
  • Once the user selects any value in the combo box, the button will be enabled and ready to clickable. The warning message will also disappear.
button disable in Power Apps
Disable button in PowerApps
  • To workaround with this, Select the Label and apply the below code on its Visible property as:
Visible = IsBlank(ComboBox1.Selected)

Where,

ComboBox1 = Combo box control name

disable button in PowerApps
Power Apps disable button example
  • Next, Select the Next button and set its DisplayMode property as:
DisplayMode = If(
    IsBlank(ComboBox1.Selected),
    DisplayMode.Disabled,
    DisplayMode.Edit
)
power apps disable button
  • Finally, Save and Preview the app. If you do not select any option in the combo box, you will see a warning message, and the button will be in disable mode.
  • When you select an option from the combo box, the button will be enabled and ready to press.

This is how to disable button in PowerApps.

Power Apps Button Conditional Visibility

Here, we will see how to work with PowerApps button conditional visibility.

I have a Power Apps gallery that I would like to toggle visibility on and off based on a button click.

The gallery is not displayed by default. However, it shows up if the user hits the button. It disappears after the button is clicked for the second time.

To work around this, follow the below simple steps:

1. Set Power Apps Screens (where the gallery is present) OnVisible property:

OnVisible = UpdateContext ({vargallery: false})

Where,

vargallery =