Wicked Smart Data
LearnInsightsAboutContact
Sign InLet's Build
LearnInsightsAboutContact
Sign InLet's Build
Wicked Smart Data

Intelligence, automation, and expert execution — plus an elite library of free knowledge. We turn complexity into competitive advantage.

Start a conversation

Platform

  • Learning Paths
  • Insights
  • RSS Feed

Company

  • About
  • Contact
  • Work With Us

Legal

  • Privacy Policy
  • Terms of Service

© 2026 Wicked Smart Data. All rights reserved.

Intelligence · Automation · Advantage

All Insights
Power Apps

Canvas App Dynamic Forms: Showing and Hiding Fields, Sections, and Input Controls Based on User Selections and Data Conditions

Static forms with every field visible at once are one of the most common Power Apps mistakes. This deep-dive lesson teaches you how to build truly dynamic forms — hiding and showing individual fields, grouped sections, and entire form regions based on user selections, record state, and role — using production-grade patterns that scale.

🔥 Expert28 min readNov 18, 2026Updated Nov 18, 2026
Canvas App Dynamic Forms: Showing and Hiding Fields, Sections, and Input Controls Based on User Selections and Data Conditions
On this page
  • Introduction
  • Prerequisites
  • How the `Visible` Property Actually Works
  • The Three Levels of Dynamic Visibility
  • Level 1: Individual Field Visibility
  • Level 2: Section Visibility with Containers
  • Level 3: Role-Based and Record-State-Driven Visibility
  • Handling Layout Reflow: No More Floating Gaps
  • Strategy 1: Auto-Layout Containers (Modern Apps)
  • Strategy 2: Dynamic Y Positioning (Classic Apps)
  • Strategy 3: Separate Screens
  • Data-Driven Visibility: When Rules Come from Your Data Source
  • Validation for Conditionally Visible Fields
  • Resetting Hidden Field Values
  • Multi-Step Forms: Progressive Disclosure at Scale
  • Performance Implications and Optimization
  • Advanced Pattern: Toggle-Based Section Expansion
  • Hands-On Exercise
  • Common Mistakes & Troubleshooting
  • Summary & Next Steps

Canvas App Dynamic Forms: Showing and Hiding Fields, Sections, and Input Controls Based on User Selections and Data Conditions

Introduction

Picture this: you've built a purchase request form for your company. It has thirty fields because every conceivable scenario needs to be captured — vendor details, budget codes, approval thresholds, hazardous material classifications, international shipping info, capital expenditure justifications. You ship it. Users open it. They immediately complain that it looks like a tax form from 1987. Half the fields don't apply to them. Someone submits a request for office supplies and accidentally fills in the CAPEX justification because it was sitting right there, staring at them.

This is the core failure mode of static forms, and it's entirely avoidable. Dynamic forms — forms that show only the fields relevant to the current user, the current record state, or the current selection — are one of the highest-leverage techniques in Canvas App development. They reduce cognitive load, eliminate data entry errors, enforce business rules at the UI layer, and make your app feel genuinely intelligent rather than like a digitized paper form. Done well, they're invisible: users never think "this form is hiding things from me," they just think "this is exactly what I needed to fill out."

By the end of this lesson, you'll know how to implement dynamic visibility across every level of a Canvas App — individual controls, grouped sections, entire form regions — using real Power Apps formulas and production-grade patterns. You'll understand the performance trade-offs of different approaches, avoid the mistakes that cause flickering, layout shifts, and broken validation, and build forms that behave professionally at enterprise scale.

What you'll learn:

  • How the Visible property works under the hood and what actually triggers re-evaluation
  • Techniques for showing and hiding individual controls, labeled sections, and multi-field regions using containers
  • Variable-driven state management for complex, multi-condition visibility logic
  • How to handle layout reflow when hidden controls would leave gaps in your UI
  • Validation patterns that account for conditionally visible fields
  • Performance implications of dense visibility formulas and how to mitigate them

Prerequisites

You should be comfortable with Canvas App basics — building screens, adding controls, connecting to data sources. If you're new to Power Apps, start with Build Your First Canvas App in Power Apps before diving into this material. You should also have a working understanding of Power Apps formulas; concepts like If, Switch, variables, and collections will come up throughout this lesson. If your formula fundamentals need a refresh, Master Power Apps Formulas: Navigate, Filter, Lookup, and Patch for Professional Apps covers the ground you need.


How the `Visible` Property Actually Works

Before writing a single formula, you need to understand the execution model, because misunderstanding it causes most of the bugs you'll encounter.

Every control in a Canvas App has a Visible property that accepts any expression that evaluates to true or false. Power Apps re-evaluates this expression reactively — whenever any variable, data source, or control property that the expression references changes, Power Apps schedules a re-evaluation. This is the declarative reactive model that underpins the entire platform.

Here's what that means practically: you don't write code that says "when the user selects X, run this function that makes field Y appear." Instead, you write a formula on field Y's Visible property that says "I am visible when the value of this dropdown is X." Power Apps handles the event wiring automatically.

// On a TextInput control's Visible property:
ddlRequestType.Selected.Value = "Capital Expenditure"

That's it. When the dropdown's selected value changes, Power Apps re-evaluates every formula that references ddlRequestType.Selected.Value, including this one. The control appears or disappears without any OnChange handler required.

Key insight

Because Visible is re-evaluated reactively, the formula you write should describe the current state you want, not a transition. Think in terms of conditions, not events. "This field is visible when X is true" rather than "show this field when X happens."

A hidden control (Visible = false) still exists in memory. Its properties are still evaluated. Its Default values still run. If it references a data source, that query still fires. This is crucial for performance — hiding a control does not remove it from the app's execution graph, it only removes it from the rendered output.

This also means that if a hidden field has a Required validation or a formula that throws an error, those will still execute. We'll cover how to handle conditional validation properly in a later section.


The Three Levels of Dynamic Visibility

Effective dynamic forms operate at three distinct levels. Conflating them leads to messy solutions. Let's define them clearly.

Level 1: Individual control visibility. A single input field, label, or button appears or disappears based on a condition. This is the simplest case.

Level 2: Section visibility. A labeled group of related fields — say, "International Shipping Details" with five inputs — appears or disappears as a unit. This requires container-based grouping.

Level 3: Form region visibility. An entire form panel or sub-form changes based on user role, record status, or multi-step workflow state. This requires state management via variables.

Most real forms need all three. Let's build each one.


Level 1: Individual Field Visibility

Start with a concrete scenario: a maintenance request form. Users select a request type from a dropdown — options include "Equipment Repair," "Facility Issue," and "IT Support." Each type needs slightly different fields.

Equipment Repair needs: Equipment ID, Last Service Date, Failure Description Facility Issue needs: Building, Floor, Location Description, Safety Hazard toggle IT Support needs: Device Type, Asset Tag, Software or Hardware toggle

The simplest implementation puts all of these on the screen and uses Visible to show the right ones.

// Equipment ID label - Visible property:
ddlRequestType.Selected.Value = "Equipment Repair"

// Equipment ID text input - Visible property:
ddlRequestType.Selected.Value = "Equipment Repair"

// Building dropdown - Visible property:
ddlRequestType.Selected.Value = "Facility Issue"

This works, but it has an immediate problem: when the form first loads, the dropdown has a default selection, and all the wrong fields might flash visible for a frame. More importantly, as you add conditions, the formulas start to diverge — you end up with eight fields that should all respond to the same condition, each written slightly differently, and six months later someone changes the dropdown option text from "Equipment Repair" to "Equipment & Machinery Repair" and half the fields stop responding.

The fix: use a named formula or variable to represent the selected type.

In the App's OnStart or using a named formula approach, define a central source of truth:

// App.OnStart or a named formula:
Set(gblRequestType, "");
// ddlRequestType.OnChange:
Set(gblRequestType, ddlRequestType.Selected.Value);

Now every field references gblRequestType:

// Equipment ID label and input - Visible:
gblRequestType = "Equipment Repair"

// Building dropdown - Visible:
gblRequestType = "Facility Issue"

This is better, but it still doesn't solve the real problem: if you have twenty fields across three categories, writing gblRequestType = "Equipment Repair" on eight separate controls means eight places to update when requirements change. The solution is to push the complexity into the variable itself.

Tip

For multi-condition visibility, consider storing a record in your state variable rather than a plain string. Set(gblFormState, {ShowEquipmentFields: gblRequestType = "Equipment Repair", ShowFacilityFields: gblRequestType = "Facility Issue"}) lets you write gblFormState.ShowEquipmentFields on every equipment field. When logic changes, you update one Set call.

// In ddlRequestType.OnChange:
Set(
    gblFormState,
    {
        ShowEquipmentFields: ddlRequestType.Selected.Value = "Equipment Repair",
        ShowFacilityFields: ddlRequestType.Selected.Value = "Facility Issue",
        ShowITFields: ddlRequestType.Selected.Value = "IT Support"
    }
);

// Equipment ID - Visible:
gblFormState.ShowEquipmentFields

// Building dropdown - Visible:
gblFormState.ShowFacilityFields

This record-based state pattern scales cleanly. You can add additional conditions — like whether a safety hazard has been flagged — without polluting every control's Visible formula.

For more on structuring state variables at scale, see Canvas App State Management at Scale: Global Variables, Named Formulas, and Context Isolation for Enterprise Apps, which covers exactly this pattern in depth.


Level 2: Section Visibility with Containers

Hiding individual controls leaves you with a maintenance nightmare at scale. If a section has eight fields — four inputs, four labels — you're managing sixteen Visible properties. Miss one label and you have a floating piece of text with no input next to it.

The right tool is a Container (or Vertical Container / Horizontal Container). Group all the controls for a section into a container, then set Visible on the container itself. All children inherit the container's visibility.

Here's how to do this in practice:

  1. In Power Apps Studio, select all the controls for your "Facility Issue" section — the labels, the inputs, the toggles.
  2. Right-click and choose "Group" or use the Container option in the Insert panel to wrap them. Modern Power Apps uses Horizontal and Vertical containers; for a form section, use a Vertical Container.
  3. Name the container something meaningful: ctnFacilitySection.
  4. Set ctnFacilitySection.Visible:
gblFormState.ShowFacilityFields

Now all eight controls inside that container appear and disappear together, and you're managing one formula instead of sixteen.

Warning

There's a gotcha with containers and auto-layout. If you're using a Vertical Container with auto-layout enabled, hidden sections that have zero height when invisible will cause the remaining sections to reflow upward. This is usually what you want — it eliminates the gap left by a hidden section. But if you're using manual positioning (non-auto-layout), hidden controls leave white space. We'll address the layout reflow problem in a dedicated section.

Let's build the complete maintenance form structure with containers:

Screen: scrMaintenanceRequest
├── ctnEquipmentSection (Vertical Container)
│   ├── lblEquipmentID
│   ├── txtEquipmentID
│   ├── lblLastServiceDate
│   ├── dpLastServiceDate (DatePicker)
│   └── lblFailureDescription, txtFailureDescription
├── ctnFacilitySection (Vertical Container)
│   ├── lblBuilding, ddlBuilding
│   ├── lblFloor, txtFloor
│   ├── lblLocationDescription, txtLocationDescription
│   └── tglSafetyHazard
└── ctnITSection (Vertical Container)
    ├── lblDeviceType, ddlDeviceType
    ├── lblAssetTag, txtAssetTag
    └── tglSoftwareHardware

Each container's Visible property maps to the corresponding flag in gblFormState. The request type dropdown drives the state. This is clean, maintainable, and testable.

Conditional sub-sections within a section

What about the case where a field inside a section appears only when another field within that section has a specific value? For example, if tglSafetyHazard is toggled on, an additional text area for "Hazard Description" should appear.

Handle this at Level 1 within the container:

// txtHazardDescription and its label - Visible:
tglSafetyHazard.Value = true And gblFormState.ShowFacilityFields

You need both conditions: the parent section is visible AND the specific toggle is on. This prevents the hazard description from accidentally appearing in another context.

Note

You could also nest containers — a container inside a container — where the inner container holds the hazard description and its Visible checks only tglSafetyHazard.Value. Since the outer container's visibility already gates the inner one, nesting eliminates the need for compound conditions on child controls. Both approaches work; nested containers are cleaner for complex sub-sections.


Level 3: Role-Based and Record-State-Driven Visibility

The deepest level of dynamic forms involves showing different form layouts to different users, or showing a form in different modes based on a record's workflow status.

Scenario: A capital expenditure request moves through states: Draft → Submitted → Under Review → Approved/Rejected. When the form is in Draft mode, the submitter fills in project details. When it's Under Review, an approver sees the same fields as read-only but also sees an approver-only section with approval notes and a decision toggle. When it's Approved or Rejected, everyone sees a summary view with no editable fields.

This requires combining two signals: the current user's role and the record's status.

If you're connecting to Dataverse or SharePoint, the record's status is a field you can read directly. For roles, you might be reading from a lookup table, an Azure AD group, or a column in your users table. For detailed patterns on role-based UI access, Implementing Role-Based Screen Access and Dynamic UI in Canvas Apps Using Azure AD Group Membership covers the full approach.

Let's build the state calculation:

// In App.OnStart:
Set(gblCurrentUserEmail, User().Email);

// Determine role from a SharePoint list named "AppRoles":
Set(
    gblUserRole,
    LookUp(AppRoles, UserEmail = gblCurrentUserEmail, Role)
);

When a record is loaded (say, in a Gallery's OnSelect or when navigating to the detail screen):

// In Gallery.OnSelect or in scrRequestDetail.OnVisible:
Set(
    gblSelectedRequest,
    ThisItem  // or the record loaded from your data source
);

Set(
    gblFormMode,
    {
        IsEditable: gblSelectedRequest.Status = "Draft" And gblSelectedRequest.SubmitterEmail = gblCurrentUserEmail,
        ShowApproverSection: gblUserRole = "Approver" And gblSelectedRequest.Status = "Under Review",
        ShowSummaryOnly: gblSelectedRequest.Status = "Approved" Or gblSelectedRequest.Status = "Rejected",
        ShowSubmitterFields: gblUserRole = "Submitter" Or gblSelectedRequest.Status = "Draft"
    }
);

Now your form controls use gblFormMode flags:

// Project details section container - Visible:
gblFormMode.ShowSubmitterFields

// Approver section container - Visible:
gblFormMode.ShowApproverSection

// A text input's DisplayMode property (editable vs. read-only):
If(gblFormMode.IsEditable, DisplayMode.Edit, DisplayMode.View)

Notice the distinction here: Visible controls whether a control appears at all, while DisplayMode controls whether an editable control accepts input. Use both strategically. Sometimes you want to show a field as read-only (use DisplayMode.View) rather than hide it entirely — this lets users see the existing value without editing it.


Handling Layout Reflow: No More Floating Gaps

The biggest user-experience failure in dynamic forms built by Power Apps beginners is the gap problem. Field disappears, but the space it occupied stays empty. The form looks broken.

There are three strategies, each appropriate for different scenarios.

Strategy 1: Auto-Layout Containers (Modern Apps)

If your app uses the modern controls experience with auto-layout containers, hidden controls inside a Vertical Container automatically release their space. The container shrinks to fit only the visible children. This is the cleanest solution and the one you should use in new apps.

Enable auto-layout: select your container, go to the Properties panel, and set LayoutMode to Auto. Set Direction to Vertical. Children stack top-to-bottom, and hidden children contribute zero height.

Strategy 2: Dynamic Y Positioning (Classic Apps)

For apps using traditional manual positioning, you can dynamically calculate the Y property of controls to collapse the gap. This is more work but necessary in legacy apps.

// txtAssetTag.Y (appears below Device Type):
lblDeviceType.Y + lblDeviceType.Height + 10

// If Device Type section is hidden, Asset Tag needs to move up.
// Better approach: anchor everything off container Y values.
If(
    gblFormMode.ShowDeviceTypeSection,
    ctnDeviceTypeSection.Y + ctnDeviceTypeSection.Height + 20,
    ctnPreviousSection.Y + ctnPreviousSection.Height + 20
)

This gets complicated quickly. Each control's position depends on the visibility of everything above it. A change to one section's height cascades through every Y formula below it. Use auto-layout containers instead whenever possible.

Strategy 3: Separate Screens

For dramatic form variations — where more than 50% of fields change — consider separate screens for each major form type rather than a single screen with heavy conditional visibility. Navigate between screens based on the selection, passing context via parameters.

// In request type dropdown's OnChange:
Switch(
    ddlRequestType.Selected.Value,
    "Capital Expenditure", Navigate(scrCapExForm, ScreenTransition.Fade),
    "Equipment Repair", Navigate(scrEquipmentForm, ScreenTransition.Fade),
    "Facility Issue", Navigate(scrFacilityForm, ScreenTransition.Fade)
)

This is architecturally cleaner for truly divergent forms. It has a tradeoff: navigating between screens means re-initializing form state. Use Building Multi-Screen Apps with Navigation and Variables in Power Apps as your guide for passing state across screens efficiently.


Data-Driven Visibility: When Rules Come from Your Data Source

Hard-coding visibility conditions into formulas is fine for stable business rules. But what happens when those rules are configured by administrators, vary by department, or change frequently? You need data-driven visibility.

Scenario: Your organization has fifteen regional offices. Each office has slightly different required fields for incident reports, configured in a SharePoint list called "RegionalFormConfig" with columns: Office, FieldName, IsVisible, IsRequired.

Load the configuration when the app starts:

// App.OnStart:
ClearCollect(
    colFormConfig,
    Filter(RegionalFormConfig, Office = gblCurrentUserOffice)
);

Now create a lookup helper function pattern. Because Power Apps doesn't have user-defined functions in the traditional sense, use a named formula (if your app targets the newer engine) or a consistent inline lookup pattern:

// Generic field visibility lookup:
// On control Visible property:
LookUp(colFormConfig, FieldName = "VehicleFleetID", IsVisible)

This returns the boolean value from your configuration table. If the row doesn't exist (the field isn't configured for this office), LookUp returns blank, which Canvas Apps evaluates as false in a boolean context. That means unconfigured fields default to hidden — a safe default.

Tip

Always load configuration data into a local collection at startup rather than querying SharePoint directly in each Visible formula. A Visible property can be evaluated dozens of times per second during interactions. Direct data source queries in visibility formulas will hammer your data source and cause serious performance problems. LookUp against an in-memory collection is nearly instantaneous.

For comprehensive guidance on working with collections and in-memory data, see Power Apps Collections and Local Data Management: Mastering ClearCollect, Patch, and In-Memory Data Operations.


Validation for Conditionally Visible Fields

Here's where most dynamic form implementations break: validation. A required field that's currently hidden shouldn't block form submission. But Power Apps' built-in form validation doesn't know which fields are currently visible — it validates all required fields regardless.

You need custom validation logic that's visibility-aware.

The pattern is to build a validation formula that checks required fields only when they're visible:

// Define validation on a button's OnSelect, or in a named formula:
// IsFormValid evaluates to true only when all visible required fields are filled.

Set(
    gblIsFormValid,
    // Always required:
    Not(IsBlank(txtRequestTitle.Text)) And
    Not(IsBlank(ddlRequestType.Selected.Value)) And
    // Conditionally required (only when section is visible):
    If(
        gblFormState.ShowEquipmentFields,
        Not(IsBlank(txtEquipmentID.Text)) And
        Not(IsBlank(txtFailureDescription.Text)),
        true  // section is hidden, skip these validations
    ) And
    If(
        gblFormState.ShowFacilityFields,
        Not(IsBlank(ddlBuilding.Selected.Value)),
        true
    ) And
    If(
        gblFormState.ShowITFields,
        Not(IsBlank(ddlDeviceType.Selected.Value)) And
        Not(IsBlank(txtAssetTag.Text)),
        true
    )
);

Then your submit button's OnSelect:

If(
    gblIsFormValid,
    // proceed with Patch() to save the record
    Patch(
        MaintenanceRequests,
        Defaults(MaintenanceRequests),
        {
            Title: txtRequestTitle.Text,
            RequestType: ddlRequestType.Selected.Value,
            EquipmentID: If(gblFormState.ShowEquipmentFields, txtEquipmentID.Text, Blank()),
            Building: If(gblFormState.ShowFacilityFields, ddlBuilding.Selected.Value, Blank()),
            // ... other fields
        }
    ),
    // show validation errors
    Notify("Please complete all required fields before submitting.", NotificationType.Error)
);

Notice the Patch formula also uses visibility conditions to null out hidden fields. This prevents stale data from a previous selection from being written to hidden fields. If a user selects "Equipment Repair," fills in the equipment ID, then changes their selection to "Facility Issue," the equipment ID input still has its value in memory even though the field is hidden. Without the If(gblFormState.ShowEquipmentFields, txtEquipmentID.Text, Blank()) pattern, that stale value would be written to the record.

Warning

Never rely on a hidden field being empty just because it's invisible. Users can fill in a field, change a selection that hides it, and the control retains its value. Always explicitly null out hidden fields in your Patch formula or reset them in the visibility-triggering control's OnChange.

For deeper coverage of validation patterns, Power Apps Data Validation: Using If, IsBlank, and IsMatch to Prevent Bad Data in Forms has the full toolkit.


Resetting Hidden Field Values

There are two philosophies on when to clear hidden field values:

Reset on hide (eager reset): When a user changes a selection that hides a section, immediately reset those fields to their defaults. Do this in the triggering control's OnChange:

// ddlRequestType.OnChange:
Set(gblRequestType, ddlRequestType.Selected.Value);

// Reset fields that are no longer relevant:
If(
    gblRequestType <> "Equipment Repair",
    Reset(txtEquipmentID); Reset(dpLastServiceDate); Reset(txtFailureDescription)
);

If(
    gblRequestType <> "Facility Issue",
    Reset(ddlBuilding); Reset(txtFloor); Reset(txtLocationDescription); Reset(tglSafetyHazard)
);

Reset on submit (lazy reset): Only null out hidden fields at submission time, as shown in the Patch formula above. Leave the values in place in case the user switches back.

The eager reset approach gives users a clean slate when they change their selection, which prevents confusion about whether old values are still there. The lazy reset approach preserves values across selection changes, which is useful if users frequently toggle between options. Choose based on your users' likely behavior. For forms where users are exploring options, lazy reset is more forgiving. For forms where changing the type truly starts a new context, eager reset communicates the right mental model.


Multi-Step Forms: Progressive Disclosure at Scale

Dynamic visibility isn't just about responding to dropdown selections. It's also the foundation of multi-step or wizard-style forms — where the form reveals additional sections as earlier sections are completed.

Scenario: An onboarding form for new vendors. Step 1 collects basic company info. Step 2 (which appears after Step 1 is complete) collects banking details. Step 3 (appears after Step 2) captures compliance documents and certifications.

Model this with a step variable:

// Initialize in App.OnStart:
Set(gblOnboardingStep, 1);

Each section's Visible property:

// Step 1 section - always visible:
true

// Step 2 section - visible when step >= 2:
gblOnboardingStep >= 2

// Step 3 section - visible when step >= 3:
gblOnboardingStep >= 3

The "Next" button at the end of each step validates the current step and advances:

// "Next" button after Step 1 - OnSelect:
If(
    // Validate step 1 fields:
    Not(IsBlank(txtCompanyName.Text)) And
    Not(IsBlank(txtTaxID.Text)) And
    IsMatch(txtTaxID.Text, "\d{2}-\d{7}"),
    // Advance to step 2:
    Set(gblOnboardingStep, 2);
    // Scroll to the step 2 section:
    // (use a timer or ScrollTo if supported in your app version)
    Notify("Step 1 complete. Please enter your banking details.", NotificationType.Information),
    // Show errors:
    Set(gblShowValidationErrors, true);
    Notify("Please complete all required fields in Step 1.", NotificationType.Warning)
);

Add a progress indicator by using the step variable to drive a visual:

// Progress bar width (inside a container of fixed width, say 600px):
(gblOnboardingStep / 3) * 600

This pattern uses visibility as a progressive disclosure mechanism rather than a selection-based switch. It's a fundamentally different UX paradigm but uses identical technical infrastructure.

Key insight

Multi-step forms are really just dynamic visibility with a sequential trigger. The same container-based grouping, state variable, and conditional validation patterns apply. You're not building something categorically different — you're applying the same primitives in a different arrangement.


Performance Implications and Optimization

Here's where advanced practitioners need to be careful. Visibility formulas are evaluated constantly. Every user interaction — mouse movement over a control, focus change, any value update — can trigger re-evaluation of reactive dependencies. If your visibility formulas are expensive, your form becomes sluggish.

What makes a visibility formula expensive:

  1. Direct data source queries. Filter(SharePointList, Condition) in a Visible property queries SharePoint every time it's re-evaluated. Use collections loaded at startup instead.

  2. Complex nested functions. A Visible formula that calls LookUp inside If inside Switch inside And creates a deep evaluation tree. Flatten it.

  3. Many controls referencing the same expensive formula. If thirty controls all independently evaluate gblUserRole = "Manager" And LookUp(...), that lookup runs thirty times on every evaluation cycle.

Optimization patterns:

Pre-compute in state variables. Move all complex logic into gblFormState (a record) computed once in OnChange or OnVisible. Each control's Visible property then reads a simple boolean from the record — O(1) lookup.

// Instead of this on 20 controls:
LookUp(colFormConfig, FieldName = "VehicleFleetID", IsVisible) And gblUserRole = "FleetManager"

// Do this once:
Set(gblFormState, {
    ShowVehicleSection: LookUp(colFormConfig, FieldName = "VehicleFleetID", IsVisible) And gblUserRole = "FleetManager",
    // ... other flags
});

// And on each control:
gblFormState.ShowVehicleSection

Use With() for intermediate calculations. The With() function lets you compute an intermediate value once and reference it multiple times within a formula:

With(
    {userConfig: LookUp(colFormConfig, UserEmail = gblCurrentUserEmail)},
    {
        ShowVehicleSection: userConfig.CanSeeVehicles,
        ShowFinanceSection: userConfig.CanSeeFinancials,
        ShowHRSection: userConfig.CanSeeHRData
    }
)

Minimize the control count on screens with heavy visibility logic. Every control contributes to the evaluation graph, even hidden ones. If you have a screen with 80 controls and 60 are potentially hidden, consider whether splitting into multiple screens would improve performance without harming UX.

Tip

Use the Power Apps Monitor tool to observe formula evaluations in real time. You can see exactly which formulas are being evaluated during interactions, their evaluation time, and whether they're hitting data sources. This is invaluable for diagnosing slow dynamic form behavior. See Debugging Canvas Apps: Using the Power Apps Monitor Tool and Formula Errors to Fix Issues Fast for a full walkthrough of this tool.

For a comprehensive look at performance optimization across Canvas Apps, Power Apps Performance Optimization: Delegation, Data Row Limits, and Reducing App Load Times covers the full performance landscape.


Advanced Pattern: Toggle-Based Section Expansion

A common UX pattern in complex forms is the collapsible section — a labeled section header that users can click to expand or collapse. This is different from automatic visibility; it's user-controlled. Think of it as an accordion control.

Canvas Apps doesn't have a native accordion, but you can build one with a container and a boolean variable per section:

// In App.OnStart or scrForm.OnVisible:
Set(gblSections, {
    BasicInfoExpanded: true,
    FinancialDetailsExpanded: false,
    ComplianceExpanded: false
});

Each section header is a button or a container styled as a clickable header:

// btnBasicInfoHeader.OnSelect:
Set(gblSections, Patch(gblSections, {BasicInfoExpanded: !gblSections.BasicInfoExpanded}));
// ctnBasicInfoContent.Visible:
gblSections.BasicInfoExpanded

Add a visual indicator (a chevron icon that rotates):

// Icon control Rotation property:
If(gblSections.BasicInfoExpanded, 180, 0)

This creates a smooth, professional accordion experience with minimal code. The Patch function on a record variable lets you update one field without overwriting the others — cleaner than individual Set calls for each section flag.


Hands-On Exercise

Build a Project Expense Claim Form that demonstrates all three levels of dynamic visibility. Here's the specification:

Form structure:

  • A header section (always visible): Project Name (lookup dropdown), Claimant Name (pre-populated from User().FullName), Claim Date (DatePicker)
  • An expense type dropdown: "Travel," "Equipment Purchase," "Training & Conference," "Meals & Entertainment"
  • Travel section (visible when "Travel" selected): Origin City, Destination City, Travel Mode dropdown (Flight/Train/Car), Mileage (visible only when Travel Mode = "Car")
  • Equipment section (visible when "Equipment Purchase" selected): Equipment Description, Vendor Name, Asset Required toggle, Asset Category (visible only when Asset Required = true)
  • Training section (visible when "Training & Conference" selected): Event Name, Event URL, Number of Attendees, Pre-Approval Reference
  • Meals section (visible when "Meals & Entertainment"): Occasion Description, Number of Guests, Business Purpose
  • Amount field (always visible): Total Amount, Currency dropdown
  • A multi-line Comments field (always visible)
  • Submit button with visibility-aware validation

Step 1: Create a Vertical Container for each section and name them clearly.

Step 2: Set up gblFormState as a record with one boolean flag per section and sub-condition:

// In ddlExpenseType.OnChange:
Set(
    gblFormState,
    {
        ShowTravel: ddlExpenseType.Selected.Value = "Travel",
        ShowEquipment: ddlExpenseType.Selected.Value = "Equipment Purchase",
        ShowTraining: ddlExpenseType.Selected.Value = "Training & Conference",
        ShowMeals: ddlExpenseType.Selected.Value = "Meals & Entertainment",
        ShowMileage: ddlExpenseType.Selected.Value = "Travel" And ddlTravelMode.Selected.Value = "Car",
        ShowAssetCategory: ddlExpenseType.Selected.Value = "Equipment Purchase" And tglAssetRequired.Value = true
    }
);

Step 3: Note that ShowMileage and ShowAssetCategory depend on controls inside the conditional sections (ddlTravelMode and tglAssetRequired). This means you also need to update gblFormState in those controls' OnChange:

// ddlTravelMode.OnChange:
Set(gblFormState, Patch(gblFormState, {ShowMileage: ddlTravelMode.Selected.Value = "Car"}));

// tglAssetRequired.OnChange:
Set(gblFormState, Patch(gblFormState, {ShowAssetCategory: tglAssetRequired.Value}));

Step 4: Build the validation formula that checks required fields only when their section is visible.

Step 5: Add an OnChange reset to ddlExpenseType that clears all section-specific fields when the type changes, preventing stale data from being submitted.


Common Mistakes & Troubleshooting

Mistake 1: Referencing a control inside a hidden container from outside it.

If ctnEquipmentSection is hidden and you reference txtEquipmentID.Text from outside the container, Power Apps may throw an error or return blank unexpectedly. Always check that cross-container references are intentional and account for the hidden state.

Mistake 2: Circular dependencies in visibility formulas.

Control A's Visible formula references Control B's value. Control B's Default or Items formula references whether Control A is visible. Power Apps will warn about circular dependencies and may behave unpredictably. Break the cycle by routing through a variable.

Mistake 3: Forgetting to handle the initial state.

Your form loads. The state variable hasn't been set yet. All the boolean flags are blank, which evaluates as false. All sections are hidden. The form looks empty. Fix this by initializing gblFormState in App.OnStart with sensible defaults, or in the screen's OnVisible.

Mistake 4: Building visibility logic in Visible instead of state variables.

A Visible property that contains a complex multi-condition formula is a ticking time bomb. It works, but it's impossible to test, difficult to debug, and evaluated constantly. Move logic to state variables. Treat Visible properties as read-only displays of pre-computed truth.

Mistake 5: Not testing the transition path, only the end state.

You test: Select "Equipment Repair" → equipment fields appear ✓. You forget to test: Select "Equipment Repair" → fill in fields → Select "Facility Issue" → Select "Equipment Repair" again. Do the fields re-appear cleanly? Are the values from before still there or reset? Test every transition, not just the initial selection.

Mistake 6: Using Visible to implement security.

A hidden field is not a secure field. Its value exists in the app's state and can be read by a determined user examining network traffic or app internals. Never hide a field as a security measure — use proper data permissions at the data source level. For security best practices, Power Apps Security: Roles, Sharing, and Data Permissions covers this in full.

Warning

Visible = false is a UI mechanism, not a security mechanism. If a field contains sensitive data that a user shouldn't see, the solution is to never fetch that data for that user in the first place — not to hide the control that displays it.

Troubleshooting: Controls flicker on load

Symptom: When the form first renders, you briefly see fields flash visible before they hide. This is a timing issue — the state variable hasn't been initialized before the screen renders.

Fix: Initialize gblFormState in App.OnStart rather than in a screen's OnVisible, or set default values directly in the Visible formula using Coalesce:

// Control Visible property:
Coalesce(gblFormState.ShowEquipmentFields, false)

Coalesce returns the first non-blank value, so if gblFormState.ShowEquipmentFields is blank (not yet set), it falls through to false. No flicker.

Troubleshooting: Submit button disabled even when all fields are filled

Likely cause: A hidden field is failing validation because its Required or custom validation is still being evaluated. Check whether any hidden fields have required constraints or inline validation formulas that return false when the field is empty. Use the conditional validation pattern described earlier to skip validation for hidden sections.


Summary & Next Steps

Dynamic forms are the difference between a Power App that feels like enterprise software and one that feels like a cluttered spreadsheet exported to a screen. The key principles to carry forward:

Architecture first. Use containers to group related fields. Set Visible on the container, not on dozens of individual controls. This is the most impactful single change you can make to a messy dynamic form.

State variables are your source of truth. Pre-compute visibility conditions into a named record variable (gblFormState). Read from that variable in every Visible property. Never compute conditions inline in Visible formulas if those conditions are shared across multiple controls.

Validation must be visibility-aware. Build custom validation logic that checks required fields only when their section is visible. Null out hidden field values at submit time to prevent stale data writes.

Performance is about evaluation frequency. Because Visible formulas are evaluated reactively and constantly, expensive operations in visibility formulas cause real performance problems. Push complexity into variables that compute once; keep Visible formulas as simple boolean reads.

Hidden is not secure. Use visibility for UX logic only. Security belongs at the data layer.

From here, there are several natural directions to explore. If your forms need to surface different field sets based on complex user roles pulled from Azure AD, Implementing Role-Based Screen Access and Dynamic UI in Canvas Apps Using Azure AD Group Membership is your next stop. If you're building reusable form components that encapsulate their own visibility logic, Power Apps Components: Build Reusable UI Elements for Enterprise Scale covers how to package this into proper components with custom properties. And if you want to test that your dynamic forms behave correctly across all selection states in an automated suite, Power Apps Canvas App Automated Testing: Building Test Suites with Test Studio and Power Automate for CI/CD Pipelines will show you how to validate every transition path without manual clicking.

Dynamic forms aren't a feature you add at the end — they're a design commitment you make at the beginning. Start with the state model, build your containers, and let visibility logic flow naturally from there. Your users will never know how much complexity you've hidden from them. That's exactly the point.

Work With Us

From insight to implementation

Reading is the start. When you're ready to build the data, automation, or AI systems behind it, our team turns strategy into shipped results.

Let's Build

Canvas Apps 101

Previous

Canvas App User Filtering and Search: Building a Live-Search Toolbar with Text Input, Filter, and Gallery Refresh for Practitioner-Grade Data Browsing*

Related Insights

Power AppsPractitioner

Configuring Dataverse Table-Level Auditing, Audit Log Retention Policies, and Audit History Subgrid Display in Model-Driven App Forms

26 min
Power AppsPractitioner

Canvas App User Filtering and Search: Building a Live-Search Toolbar with Text Input, Filter, and Gallery Refresh for Practitioner-Grade Data Browsing*

20 min
Power AppsFoundation

Configuring Model-Driven App Navigation Behavior for Lookup Columns: Controlling In-Line Editing, Lookup Dialog Filters, and Default Table Views on Form Fields

19 min

On this page

  • Introduction
  • Prerequisites
  • How the `Visible` Property Actually Works
  • The Three Levels of Dynamic Visibility
  • Level 1: Individual Field Visibility
  • Level 2: Section Visibility with Containers
  • Level 3: Role-Based and Record-State-Driven Visibility
  • Handling Layout Reflow: No More Floating Gaps
  • Strategy 1: Auto-Layout Containers (Modern Apps)
  • Strategy 2: Dynamic Y Positioning (Classic Apps)
  • Strategy 3: Separate Screens
  • Data-Driven Visibility: When Rules Come from Your Data Source
  • Validation for Conditionally Visible Fields
  • Resetting Hidden Field Values
  • Multi-Step Forms: Progressive Disclosure at Scale
  • Performance Implications and Optimization
  • Advanced Pattern: Toggle-Based Section Expansion
  • Hands-On Exercise
  • Common Mistakes & Troubleshooting
  • Summary & Next Steps