Skip to main content

How to Add a Horizontal Container in Power Apps

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

A horizontal container lines up the controls inside it from left to right and spreads them across the space it has. Placed inside a vertical container, it's the natural way to build a header bar, a row of buttons, or a picture next to some text. Here's how to add one and give it a fixed height, using an app header as the example.

Prerequisites​

Step 1: Insert It Inside the Vertical Container​

Select the vertical container in the tree view, open Insert → Layout and select Horizontal container:

The Insert pane with the Layout category open and Horizontal container outlined in red, between Container and Vertical container

As the only child of the vertical container, it fills it. The breadcrumb at the bottom of the canvas shows where it sits: Home Screen → conMainHS → Container2:

A new horizontal container filling the screen-level container, with the properties pane showing Direction Horizontal, Justify (horizontal), Align (vertical), Gap 0, Overflow Hide and Wrap Off, and the breadcrumb Home Screen, conMainHS, Container2 at the bottom

Rename it; the example uses conHeaderHS.

Step 2: Give It a Fixed Height​

Inside a vertical container, a child has a Flexible height switch in Size and position. On means it takes a share of the spare height; for a header you want a fixed height instead. Turn Flexible height Off and set Height:

SettingValue
Flexible heightOff
Height64

The header container now 64 pixels high at the top of the screen, with Flexible height Off and Height 64 outlined in red in the properties pane

Anything you add below it in the vertical container can keep Flexible height On and take the rest of the screen.

Step 3: Style It as a Header​

PropertyValueWhy
FillApp.Theme.Colors.PrimaryFollows the app's theme; see How to Use Theme Colors and Fonts in Power Apps Formulas
PaddingLeft, PaddingRight24Keeps the title off the edge
PaddingTop, PaddingBottom0The height is fixed already
Align (vertical)CenterCenters the title in the bar
DropShadowDropShadow.NoneA flat bar
Radius (all four)0Square corners

Step 4: Add Controls Side by Side​

Select the horizontal container and insert controls; they line up left to right. Each child gets a Flexible width switch. On, it stretches to fill the spare width (in proportion to Fill portions); Off, it keeps its Width. In the example, the title label has Flexible width On, so it uses the whole bar; see How to Add a Heading for Screen Readers in Power Apps.

Common Mistakes​

MistakeWhat happensDo this instead
Leaving Flexible height on for a headerIt grows to share the screenTurn it off and set Height
Inserting with a child control selectedThe new control goes into that child's containerSelect the container you want first
Hard-coding the header colorIt doesn't follow theme changesUse App.Theme.Colors.Primary

Troubleshooting​

SymptomLikely causeFix
No Flexible height switchThe container isn't inside a vertical containerMove it into one
Children overlap or get cut offNot enough widthTurn on Wrap, or let some children have Flexible width
The container ended up in the wrong placeThe wrong item was selected when insertingUndo, select the right container, insert again

FAQ​

Horizontal or vertical?​

Use a horizontal container for things side by side (a header, a row of buttons), and a vertical one for things stacked (sections of a page).

What does Fill portions do?​

Among flexible children, it sets the share each gets. Two children with 1 split the space evenly; 1 and 3 split it a quarter and three-quarters.

Can the row wrap on small screens?​

Yes. Turn on Wrap, and children that don't fit move to the next line.

Conclusion​

Insert a Horizontal container inside your vertical one, switch Flexible height off with a fixed Height for bars like a header, and let its children share the width with Flexible width. It's half of every responsive layout.

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.