How to Use Power Apps Button Control | Power Apps Button OnSelect

The Power Apps button control performs many actions, such as navigating between screens and triggering a Power Automate flow, submitting data to the SharePoint list, and more.

In this article, I will explain about Power Apps Button Control, its properties, and how to use it with the examples below:

  • Navigate to another screen with the Power Apps button control
  • Submit form data to SharePoint list with Power Apps button control
  • Open URL with Power Apps button control
  • Filter Data table with Power Apps button control
  • Show/Hide Power Apps button control based on the current user

Power Apps Button Control Properties

The key properties of the Power Apps button control are Text and OnSelect.

  • The OnSelect property performs some actions when the user clicks the button control.
  • Text property is used to display text on the button control.

Follow the steps below to use the Power Apps button control.

1. To add a button control to a screen, click the +Insert tab and select the Button like in the image below.

Power Apps button control

2. Open the Properties pane of button control on the right side. Fill in the following properties.

powerapps button pressed
Property Description
TextTo display the name on the button control.
Display modeEdit, Disabled, View. According to our requirements, we can set the display mode.
VisibleIt enables us to make the button control visible or not.
X The distance between the left edge screen and the button control.
YThe distance between the top edge of the screen and the button control.
Padding(Top, Bottom, Left, Right)These are the distances between the text on the button control and the border of the button control.
ColorProvide color for the text on the button control.
FillProvide the background color of the button control.
Border Provide a border to the button control; you can also select the border style and provide the size.
Border radiusProvide the number for the border-radius according to your wish
3. Also, look at some other properties of the Power Apps button control.
power apps button control properties
PropertyDescription
FontChoose font style for the text present in the button control.
Font size Provide the number for font size
Font weight Choose the font weight from the dropdown, such as Bold, Semibold, Normal, or Lighter.
Text alignment Select a font style like Italic, Underline, or Strike.
Vertical alignChoose an option in the dropdown, such as Top, Middle, and Bottom.
Provide colors for Disable and Pressed Hover properties
TooltipProvide some text to the tooltip; when we hover the mouse on the button control, it displays the text we provided in this property.
Tab indexProvide some text to the tooltip; hovering the mouse on the button control displays the text we provided in this property.
These are the properties of the Power Apps button control

Navigate to Other Screen With the Power Apps Button Control

Look at the example below. When I click the New Request button control, I navigate to another screen.

powerapps button onselect change screen

Follow the steps below to achieve this!

1. In Power Apps, add a button control and provide the formula below for the OnSelect property of the button control.

Navigate(leaveRequestForm_Screen,ScreenTransition.CoverRight);

The Navigate () function navigates between the screens within the Power Apps application.

  • leaveRequestForm_Screen = Destination screen name.
  • ScreenTransition = This property describes how the current screen changes to the destination screen.
powerapps navigate to another screen after submit

2. Now, save the changes and preview the application. When you click the new request button, it will navigate you to another screen.

This way, we can navigate from one screen to another using the Power Apps button control.

Power Apps Button Control to Submit Form

In this section, we’ll see how to submit the Power Apps form data to the SharePoint list using button control.

In the example below, you can see when you click on the submit button, the details present in the Power Apps form are submitted to the SharePoint list.

power apps button control to submit form

Here is the SharePoint list named Employee Leave Request, which has the following columns.

powerapps submit form to sharepoint list using button control

Follow the steps below to achieve this!

1. From the +Insert tab, add an Edit form control to the Power Apps screen and connect it with the SharePoint list.

DataSource = 'Employee Leave Request'
powerapps save data to sharepoint list with button

2. Then, add a button control and provide the formula below in its OnSelect property to submit the form data to the SharePoint list.

SubmitForm(Frm_leaveRequest);

The SubmitForm() function will submit the Power Apps form data to the SharePoint list.

powerapps button save data to sharepoint list

Now, save the changes and preview the app. After clicking the submit button in Power Apps, the details will be stored in the SharePoint list.

powerapps save form button

This way, we can save the Power Apps form data to the SharePoint list with a single click of a button.

Power Apps Button Open URL

Here, we’ll see how to open a URL with the Power Apps button control in the new tab. The example below shows that the URL opens in the new tab when I click the Register Now! button.

power apps button open url

Follow the steps below to achieve this!

1. Add a Power Apps button control and provide the formula in the OnSelect property of the button control.

Launch("https://info.microsoft.com/ww-landing-DriveReal Business Resultswith PowerPlatform.html?lcid=en-us");

Here, the Launch() function in Power Apps works as a hyperlink, launching webpages and other applications from the current application.

Provide the link within the double quotations ” “ in the launch function.

power apps button link to website

Now save and preview the app. When you click the register now button, the provided URL will open in a new tab.

Filter Data Table on Button Click in PowerApps

Let’s see how to filter the data table by clicking the Power Apps button. Here, I have a SharePoint list named Issue Tracker, which has a priority choice field.

powerapps filter datatable with button

Now, in the Power Apps data table, the issues with the selected priority are filtered after choosing the priority value from the dropdown and clicking on the button control.

filter data table on button click powerapps

To achieve this, follow the steps below!

1. In Power Apps, add a Dropdown control from the +Insert tab and provide the formula below for its items property.

Distinct('Issue Tracker',Priority.Value)

The Distinct() will retrieve all the priority choice field values used in the SharePoint list.

  • ‘Issue Tracker’ = SharePoint list name.
  • Priority = SharePoint list choice field name.
power apps button to filter data table based on dropdown

2. Then, add a Power Apps Button control and provide the below formula in its OnSelect property.

Set(varSelectedPriority, drp_priority.Selected.Value);
Navigate(FilterIssues_screen, ScreenTransition.Cover)

Here, the varSelectedPriority variable stores the dropdown selected value. By clicking this button, the Navigate () function navigates to another screen.

power apps filter data table with button control

3. In the new screen, add a Power Apps data table control to display the Issues based on the dropdown selection in the previous screen. Provide the formula below for the Items property of the data table control.

Filter('Issue Tracker', Priority.Value = varSelectedPriority)

Here,

  • ‘Issue Tracker’ = SharePoint list name.
  • Priority = SharePoint list choice field name.
  • varSelectedPriority = Variable that we created on the buttons on select property.

The Filter() function will filter the SharePoint list items based on the priority values.

how to use button to display filtered data in powerapps

Save the changes and preview the app once. Then, choose one priority option and click on the button control; then, in the data table, you’ll see the issues with the selected priority.

power apps filter datatable by button

Show/Hide Power Apps Button Based on Current User

This section will show you how to show/hide the Power Apps button control based on the current user.

Here, I have a SharePoint list named Admin People, which stores the admin people’s names.

power apps show hide button

Look at the example below; I can see the All details button control when I’m in the admin people SharePoint list once; I removed the button control, which is not visible.

show/hide button in power apps based on the current user

To achieve this, follow the steps below!

1. Connect Power Apps with the SharePoint list and then add the formula below in the App’s OnStart property.

ClearCollect(colAdmins,'Admin People'.'HR People');
Set(
    isUserAuthorized,
    !IsEmpty(
        Filter(
            colAdmins,
            User().Email in 'HR People'.Email
        )
    )
);

Here, I created a Power Apps collection named colAdmins, which stores the HR People field data present in the Admin People SharePoint list.

Then, using the Filter() function, I check whether the current user is in the collection. If present, the isUserAuthorized variable contains a true value; if not, it contains a false value.

powerapps hide button based on user

2. Provide the below variable in the Visible property of the button control.

isUserAuthorized
powerapps show hide button based on user

3. Save the changes and run the Apps OnStart property; if you’re in the admin people SharePoint list, you can see the All Request button. If not, you can’t see it.

In the image below, you can see the current user is not present in the SharePoint list, so the button control is not visible in Power Apps.

show or hide button in power apps based on the current user

This way, we can show/hide the Power Apps button control based on the current user.

I hope you understand how to use the Power Apps button control, its properties, and how to perform actions using its OnSelect property.

You can follow this article if you’re new to using Power Apps button control. Also, you may like some other Power Apps controls like:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…