Create Custom People Picker Control In PowerApps

In PowerApps, you might come across a scenario where you need a field like Person and Group (people picker) field in SharePoint. Yes, in this blog we will see how we can create a people picker control in PowerApps forms.
 
People picker field is not there by default in PowerApps. So, in some custom form if you need to provide such a field so that users can select the person, then you need to build it from the combination of some other core fields. Let’s start with that.
 
You can build this field with a combination of various fields like Textbox, list box, combo box, icons, and label. Here I will explain with a minimum of two controls, Textbox and List Box.
 
Add List box controls and set the below properties to it:
  1. Items - If(!IsBlank(TxtSearchUserName_2.Text), Office365Users.SearchUser({searchTerm:TxtSearchUserName_2.Text}).Mail)
  2. Visible - ShowUsersListBox
  3. OnSelect - Set(SelectedUserEmail, ListBoxSearchedUsers_2.SelectedText.Value); Set(ShowUsersListBox,false);Reset(TxtSearchUserName_2)
Add Text box control on top of List box, and set the below properties to it:
  1. Default - SelectedUserEmail
  2. OnSelect - Set(ShowUsersListBox,true)
So what are we trying to do? Once a user clicks on Textbox we are making List Box visible. List box data source is set to filtered Office356Users using SearchUser function. And once user selects one of the items from the List box then set selected email or display name as per your need to Text box.
 
Create Custom People Picker Control In PowerApps
 
As you start typing in TxtSearchUserName_2 control, the result will start appearing in the listbox below:
 
Create Custom People Picker Control In PowerApps
 
That’s it. You can build more enhanced people picker controls using Combo box as well with a personal photo and multiple properties to be shown in the result box.