How to Build Bulk Checkbox Selection (Select All) in Power Apps Gallery

Checkboxes are commonly used in groups, but Power Apps doesn’t provide a native way to group classic checkboxes. This can be challenging when you need to manipulate multiple checkboxes simultaneously.

⚠️ Note on Modern Controls (2025 Update):
If you are using the new Modern Table Control, bulk selection (multi-select) is a built-in feature. You don’t need to build it manually.
However, if you need custom layouts using a Gallery or require complex logic, the method described in this article is still the best solution.

I encountered this limitation while working on a project requiring a highly customized UI, so I’d like to share my solution for managing multiple checkboxes efficiently in Power Apps.

スポンサーリンク

About Checkboxes

Let’s start with some checkbox basics. A checkbox is a control element that has two states: “checked” (true) and “unchecked” (false).

*Note: For single-choice selections, radio buttons are the more appropriate option.

In Power Apps, you can monitor the checkbox state through its Value property:

  • Checked state → true
  • Unchecked state → false

Implementation

Now, let’s implement the bulk operation (“Select All”) for multiple checkboxes inside a Gallery.

Step 1: Create a Collection

First, create a collection that will serve as the data source for our checkboxes. You can do this in the OnVisible property of the screen.

Power Apps formula to create a collection named ColCheckboxes using ClearCollect
ClearCollect(ColCheckboxes,
    {Name: "Option A", Value: false},
    {Name: "Option B", Value: false},
    {Name: "Option C", Value: false},
    {Name: "Option D", Value: false},
    {Name: "Option E", Value: false}
)

Step 2: Setup the Gallery

Add a Gallery control (Vertical or Horizontal) and connect it to the ColCheckboxes collection we just created.

Adding a blank vertical gallery to the screen
Connecting the gallery data source to ColCheckboxes

Step 3: Add Checkbox to Gallery

Add a Checkbox control inside the gallery.

Adding a checkbox control inside the gallery template

Set the Checkbox properties as follows to bind it to the collection:

  • Text: ThisItem.Name
  • Default: ThisItem.Value
Setting the Default and Text properties of the checkbox

Step 4: Sync Checkbox State to Collection

Crucially, we need to update the collection whenever a user manually checks or unchecks a box. Use the Patch function in the OnCheck and OnUncheck properties.

Setting the OnCheck and OnUncheck properties to update the collection
// OnCheck & OnUncheck
Patch(ColCheckboxes, ThisItem, {Value: Self.Value})

(Optional) Add a label to visualize the Value property for testing.

Adding a label to display the boolean value of the checkbox
Verifying that the label updates when checkbox is toggled

Bulk Operations (Select All / Deselect All)

Select All

To check all boxes at once, use the UpdateIf function to update the entire collection.

Adding a button to select all checkboxes using UpdateIf
// OnSelect of "Select All" button
UpdateIf(ColCheckboxes, true, {Value: true})
All checkboxes being selected simultaneously

Deselect All

Similarly, use UpdateIf to set all values to false.

Adding a button to deselect all checkboxes
// OnSelect of "Deselect All" button
UpdateIf(ColCheckboxes, true, {Value: false})
All checkboxes being deselected simultaneously

Counting & Validation

Count Selected Items

To count how many items are checked, use CountIf.

Using CountIf to count selected items
CountIf(ColCheckboxes, Value = true)
The count label updating automatically

Check if “All Selected”

You can easily verify if all checkboxes are checked by comparing the count to the total rows.

Formula to check if the count of selected items equals total items
CountIf(ColCheckboxes, Value = true) = CountRows(ColCheckboxes)
Label showing true when all items are selected

Dynamic Options (Adding Items)

Since we rely on a collection, adding new options dynamically is straightforward.

Code to add a new item to the collection
Collect(ColCheckboxes, {Name: "New Option", Value: false})
New option appearing in the gallery automatically

You can even allow users to add their own options via a text input:

Code to add a user-defined item from a text input
Collect(ColCheckboxes, {Name: TextInput1.Text, Value: false})
User added option displayed in the list

Summary

While modern Table controls offer basic multi-select, using a Gallery + Collection approach gives you ultimate flexibility.

  • Full control over design and layout.
  • Ability to add dynamic logic (Sum, Validation).
  • Easy bulk updates using UpdateIf.

This pattern is essential for building advanced Power Apps interfaces.

コメント

Copied title and URL