Skip to content
Tutorials Center
My learning

Topics

Lesson 9 of 38 ยท Concepts and Canvas Apps

Responsive Layout with Containers

Build canvas app layouts that adapt to any screen using horizontal and vertical containers, flexible width and height, Parent.Width formulas and breakpoints.

A fixed layout that looks perfect on your laptop can break on a phone. Responsive design means the app adapts to the space available. In Power Apps you do this mainly with containers and formulas based on Parent and App.

Fixed layouts and their problem

By default every control has fixed X, Y, Width and Height. If you build for a 1366 by 768 tablet screen and open the app on a phone, controls overflow or sit in a corner. Two settings help first:

  • In Settings, Display, turn Scale to fit off and Lock aspect ratio off, so the app fills the window.
  • Choose layouts built with containers instead of absolute positions.

Containers

Three container controls matter:

  • Container: a free positioning box.
  • Horizontal container: lays children out left to right.
  • Vertical container: lays children out top to bottom.

For layout containers you set Direction-related properties such as Justify, Align, Gap and padding (PaddingTop, PaddingLeft, etc.). For each child you can set Fill portions, Flexible width or Flexible height: a child with flexible width takes a share of the remaining space.

A common page structure:

flowchart TD
  P["Screen"] --> V["Vertical container: page"]
  V --> H1["Horizontal container: header, fixed height"]
  V --> B["Horizontal container: body, flexible height"]
  V --> F["Horizontal container: footer, fixed height"]
  B --> L["Vertical container: menu, fixed width"]
  B --> M["Vertical container: content, flexible width"]

Fixed sizes for header, footer and menu; flexible space for the content.

Steps in Studio: insert a vertical container, set its Width to Parent.Width and Height to Parent.Height, then insert children inside it. Mark the body as flexible height so it absorbs leftover space.

Formulas for position and size

Where you do not use layout containers, write formulas that depend on the parent:

TEXT
// A label occupying the top 10 percent of the screen width
Width: Parent.Width - 40
X: 20
Height: Parent.Height * 0.1

Useful references: Parent.Width, Parent.Height, Self.X, App.Width, App.Height, App.ActiveScreen.Width.

The stand-in below computes a card layout for different screen widths, to see how a formula decides the column count.

JS Stand-in: columns from the available width

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Breakpoints with App.Width

Phones, tablets and desktops need different arrangements. You can create a named formula using width ranges:

TEXT
// In App.Formulas
ScreenSize = If(App.Width < 600, "Phone", If(App.Width < 1000, "Tablet", "Desktop"));

Then use ScreenSize in properties, for example Visible: ScreenSize <> "Phone" for a side menu, or Items: If(ScreenSize = "Phone", ...).

You can also set a gallery's TemplateSize or WrapCount based on width so cards flow into rows:

TEXT
WrapCount: Max(1, RoundDown(Self.Width / 300, 0))

Evaluate breakpoints with the stand-in:

JS Stand-in: a ScreenSize breakpoint formula

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Orientation and safe design

  • Test in portrait and landscape; some devices rotate.
  • Avoid text that grows past its box: set AutoHeight on labels or Overflow on containers.
  • Keep touch targets at least about 44 pixels high.
  • Use the same container structure on every screen so the app feels uniform.

Modern controls and themes

Newer modern controls (Fluent-style) have built-in responsive and accessibility behavior and follow a theme. Availability and maturity vary by release, so check which controls are generally available in your environment before standardizing on them.

Common mistakes

  • Positioning a control inside a container with X and Y; containers manage positions for children, so those values are ignored in horizontal and vertical containers.
  • Forgetting that Parent refers to the nearest container or screen, not the app.
  • Mixing fixed pixel sizes and flexible ones without testing smaller widths.
  • Building two separate apps for phone and tablet when one responsive layout would work.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which containers lay out their children in a row or column automatically?

    Horizontal and vertical containers manage child position and spacing.
  2. 2. What does Parent.Width refer to?

    Parent is the control that contains the current one.
  3. 3. How do you hide a side menu on phones?

    A breakpoint formula like ScreenSize <> "Phone" controls visibility.
  4. 4. What does flexible height do for a child in a vertical container?

    Flexible children share the space left after fixed-size siblings are placed.

Summary

  • Turn off Scale to fit and Lock aspect ratio for responsive apps.
  • Use horizontal and vertical containers with flexible width and height.
  • Use Parent.Width and App.Width in formulas; add a ScreenSize named formula.
  • Test portrait, landscape and several sizes.

Next: Power Fx basics