How to Set a Default Item in a Power Apps Gallery (4 Examples)

When a Power Apps screen opens, the gallery selects its first item by default. That’s rarely the one people need. In one app I built, managers wanted the Marketing team highlighted straight away, and after adding a new employee, they expected to see that person selected, not the top row.

In this tutorial, I’ll show you how to control which item a gallery selects with its Default property, with four examples: a fixed value, a record from a SharePoint list, the record a form just saved, and the item selected in another gallery.

Quick answer: Set the gallery’s Default property to a record from its Items, for example LookUp('Employee Details', 'Employee Department'.Value = "Marketing"). The gallery selects that item when the screen loads, and Gallery1.Selected returns it. To make the selection visible, set TemplateFill to If(ThisItem.IsSelected, Color.Goldenrod, Color.White).

How the Default property works

  • Default is the record the gallery selects when the app starts. It must be a record from the gallery’s Items.
  • Selected is the item that’s selected now, so other controls can read it.
  • Reset(Gallery1) goes back to the Default item, or to the first item if there’s no Default.

For the basics of the control, see how to use the gallery control in Power Apps.

Example 1: A fixed default item

I added a vertical gallery and set its Items to a simple list of products:

["Laptop", "Xbox Series S 1-TB", "Mouse", "Smartphone", "Headphones"]
Power Apps gallery Items property set to a list of products

A table written with square brackets has one column named Value. To select the Xbox by default, set the gallery’s Default to a record with that value:

{Value: "Xbox Series S 1-TB"}
Gallery Default property set to the Xbox Series S record

The gallery selects the Xbox, but you can’t see it yet. Set TemplateFill so the selected row stands out:

If(ThisItem.IsSelected, Color.Goldenrod, Color.White)
Gallery TemplateFill formula that highlights the selected item

Preview the app, and the Xbox row is highlighted as soon as the screen opens:

Power Apps gallery with the default item highlighted in gold
Power Apps gallery default item shown when the screen loads

For more ways to show the selected row, see how to highlight the selected item in a gallery.

Example 2: A default item from a SharePoint list

Next, I used a SharePoint list named Employee Details with Employee ID (Title), Employee Name, Employee Department (choice) and Employee Joining Date. I added it as a data source:

Employee Details SharePoint list added as a data source in Power Apps

Then I set the gallery’s Items to 'Employee Details':

Gallery Items property set to the Employee Details list
Power Apps gallery showing employees from the SharePoint list

To select the first Marketing employee by default, use LookUp, which returns a single record:

LookUp('Employee Details', 'Employee Department'.Value = "Marketing")
Gallery Default set with LookUp to the Marketing department

Because Employee Department is a choice column, you compare its Value. Use the same TemplateFill formula as before, with any color you like:

TemplateFill formula with a custom RGBA color for the selected employee
Power Apps gallery with the Marketing employee selected by default

LookUp is delegable for SharePoint text, number and choice columns, so it works on big lists. To fetch a record by ID instead, see how to get a gallery item by ID.

Example 3: Select the item that was just submitted

On this screen, a form adds employees and a gallery lists them. After someone submits, they expect the gallery to select the new employee:

Power Apps screen with an employee form and a gallery
Form connected to the Employee Details list

Set the Submit button’s OnSelect to SubmitForm(Form1). Then, in the form’s OnSuccess, store the saved record and clear the form:

Set(varLastEmployee, Form1.LastSubmit);
NewForm(Form1)

Form1.LastSubmit is the record SharePoint just saved, including its new ID. Now set the gallery’s Default to:

LookUp('Employee Details', ID = varLastEmployee.ID)
Gallery Items property for the employee list next to the form
TemplateFill formula for the gallery next to the form

After a successful submit, the new employee is selected:

Gallery selecting the employee that was just submitted

An older version of this post used the newest item in the list instead. That breaks when two people add employees at the same time, while LastSubmit always points to your own record. For validation before saving, see Power Apps form field validation on submit.

Example 4: Match the item selected in another gallery

Here, two galleries show the same employees, and selecting a person in the first one should select them in the second:

Two Power Apps galleries where the second follows the first
First gallery Items set to Employee Details
Second gallery Items set to Employee Details

Set the second gallery’s Default to the matching record:

LookUp('Employee Details', Title = Gallery1.Selected.Title)
Second gallery Default set with LookUp to the first gallery's selection
TemplateFill formula that highlights the matching employee

When the selection in Gallery1 changes, the Default changes, and the second gallery follows. For galleries inside galleries, see the Power Apps nested gallery guide.

Other handy defaults

Troubleshooting

  • Nothing is selected: the Default record isn’t in Items. Check that you look up the same data source the gallery shows.
  • The selection doesn’t show: set TemplateFill with ThisItem.IsSelected.
  • The default doesn’t change after a new record: Default is applied when the value changes or the gallery is reset. Update the variable in OnSuccess, as in Example 3.

These Power Apps gallery tutorials go well with this one:

Frequently Asked Questions

How do I set the default selected item in a Power Apps gallery?

Set the gallery’s Default property to a record from its Items, such as a LookUp. Microsoft lists the property in its gallery control reference.

Why doesn’t my gallery highlight the default item?

The gallery selects it, but you need TemplateFill = If(ThisItem.IsSelected, …) to show it.

How do I select the record that a form just saved?

In the form’s OnSuccess, store Form1.LastSubmit in a variable, and set the gallery’s Default to a LookUp on its ID.

Is there a modern gallery control?

Not yet. The modern controls list has no gallery, so use the classic gallery with these properties.