Skip to main content

How to Add a Vertical Container in Power Apps

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

A vertical container stacks the controls inside it, top to bottom, and works out their positions for you. You never type an X or Y for them. Put one around a whole screen and set it to the screen's size, and everything inside follows when the window gets wider or narrower. It's the starting point of a responsive canvas app.

Prerequisites​

  • A canvas app set to a responsive layout, so screens resize with the window. In current Studio this is Settings → Display → App layout: Responsive; see Part 3 of the Career Development Plan series for where it is.
  • A screen to add it to. The example is the Home screen of the Career Development Plan app, from Part 4 of the series.

Step 1: Insert a Vertical Container​

Select the screen, open Insert (+), expand Layout and select Vertical container:

The Insert pane with the Layout category expanded, listing Container, Horizontal container, Vertical container, Grid container, Vertical gallery, Horizontal gallery, Flexible height gallery, Header, Data grid, Table (Preview) and Form, with Vertical container outlined in red

It lands near the top left, 500 × 200, and the properties pane shows its layout settings:

A new 500 by 200 container selected on the canvas, with the properties pane showing Direction Vertical, Justify (vertical), Align (horizontal), Gap 0, Horizontal Overflow Hide, Vertical Overflow Hide, Wrap Off, Visible On, Position 40 and 40, Size 500 and 200, and Padding 8

Rename it straight away; the example uses conMainHS. See How to Rename a Screen or Control in Power Apps.

Step 2: Make It Fill the Screen​

Set its position and size with formulas, in the formula bar:

PropertyValue
X0
Y0
WidthParent.Width
HeightParent.Height

Parent is the screen the container sits on, so the container is always exactly the screen's size. The preview strip confirms the value at the default canvas size:

The formula bar with Height set to Parent.Height, the preview strip reading Parent.Height = 768 with Data type number, and the container filling the whole screen on the canvas with size 1366 by 768 in the properties pane

Step 3: Set How It Arranges Its Children​

Setting (properties pane)Formula propertyWhat it doesScreen-level container
DirectionLayoutDirectionStacks children vertically or horizontallyVertical
Justify (vertical)LayoutJustifyContentWhere children sit along the stackStart
Align (horizontal)LayoutAlignItemsHow children use the widthLayoutAlignItems.Stretch
GapLayoutGapSpace between children0
PaddingPaddingTop and so onSpace inside the edges0
Vertical OverflowLayoutOverflowYWhat happens when children don't fitHide, or Scroll for scrolling content

Stretch makes every child as wide as the container, which is usually what you want for full-width sections. For a container whose content can be taller than the screen, such as a page body, set Vertical Overflow to Scroll:

conBodyHS → LayoutOverflowY
LayoutOverflow.Scroll

A new container also has a light drop shadow and rounded corners. For a screen-level container, turn those off:

conMainHS → DropShadow
DropShadow.None

and set the four Radius properties to 0.

Step 4: Add Controls Inside It​

Select the container, then insert a control: it goes inside. If a control inside a container is selected when you insert, the new control goes into that control's container. Check where it landed in the tree view, by its indent, and Undo if it's in the wrong place.

Inside a vertical container, each child gets a Flexible height switch. On, it shares the leftover height (its share is Fill portions); off, it keeps a fixed Height. A fixed header with a flexible body below it is the classic pattern; How to Add a Horizontal Container in Power Apps builds that header.

Common Mistakes​

MistakeWhat happensDo this instead
Typing numbers for Width and HeightThe container doesn't resize with the windowUse Parent.Width and Parent.Height
Leaving Align on CenterChildren keep their own widths, centeredUse Stretch for full-width sections
Inserting with the wrong control selectedThe control lands in the wrong containerSelect the target container first

Troubleshooting​

SymptomLikely causeFix
The container doesn't resizeApp layout is FixedSet it to Responsive
Content is cut off at the bottomOverflow is HideSet Vertical Overflow to Scroll, or let the container grow
Can't drag a child to a new positionContainers place children themselvesChange the order in the tree view or the container's settings

FAQ​

Vertical container or plain Container?​

A plain Container lets you place children anywhere with X and Y. A vertical (or horizontal) container places them for you, which is what makes a layout responsive.

Can containers go inside containers?​

Yes. Responsive screens are usually a vertical container with horizontal and vertical containers nested inside.

Does the order in the tree view matter?​

Yes. The container stacks its children in that order, and screen readers read them in that order too.

Conclusion​

Insert a Vertical container, set it to Parent.Width by Parent.Height at 0, 0, choose Stretch, and nest the rest of the screen inside. It's the foundation of a layout that works from a phone to a wide monitor.

Additional Resources​

Stay Updated

Subscribe to our newsletter for the latest tutorials, tech insights, and developer news.

By subscribing, you agree to our privacy policy. Unsubscribe at any time.