Skip to content

Commit 16ea0ef

Browse files
authored
Merge pull request #3808 from MicrosoftDocs/responsive_app
Adding new responsive layouts
2 parents 768bb40 + 9fff095 commit 16ea0ef

18 files changed

+383
-7
lines changed
Loading

powerapps-docs/maker/TOC.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,8 @@
403403
href: ./canvas-apps/controls/control-export-import.md
404404
- name: Gallery
405405
href: ./canvas-apps/controls/control-gallery.md
406+
- name: Horizontal container (experimental)
407+
href: ./canvas-apps/controls/control-horizontal-container.md
406408
- name: HTML text
407409
href: ./canvas-apps/controls/control-html-text.md
408410
- name: Icon
@@ -447,6 +449,8 @@
447449
href: ./canvas-apps/controls/control-timer.md
448450
- name: Toggle
449451
href: ./canvas-apps/controls/control-toggle.md
452+
- name: Vertical container (experimental)
453+
href: ./canvas-apps/controls/control-vertical-container.md
450454
- name: Video
451455
href: ./canvas-apps/controls/control-audio-video.md
452456
- name: Web barcode scanner (experimental)
@@ -465,6 +469,14 @@
465469
href: ./canvas-apps/controls/properties-size-___location.md
466470
- name: Text
467471
href: ./canvas-apps/controls/properties-text.md
472+
- name: Manage screens
473+
items:
474+
- name: Build responsive apps
475+
href: canvas-apps/build-responsive-apps.md
476+
- name: Change screen size and orientation
477+
href: ./canvas-apps/set-aspect-ratio-portrait-landscape.md
478+
- name: Create responsive layout
479+
href: ./canvas-apps/create-responsive-layout.md
468480
- name: Configure app functionality
469481
items:
470482
- name: Get started with formulas
@@ -905,12 +917,6 @@
905917
href: ./canvas-apps/restore-an-app.md
906918
- name: Change app name and tile
907919
href: ./canvas-apps/set-name-tile.md
908-
- name: Manage screens
909-
items:
910-
- name: Change screen size and orientation
911-
href: ./canvas-apps/set-aspect-ratio-portrait-landscape.md
912-
- name: Create responsive layout
913-
href: ./canvas-apps/create-responsive-layout.md
914920
- name: Test an app with Test Studio
915921
items:
916922
- name: Test Studio Overview
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
---
2+
title: Build responsive apps in canvas apps | Microsoft Docs
3+
description: Reference information about building responsive apps in canvas apps
4+
author: emcoope-msft
5+
manager: kvivek
6+
ms.service: powerapps
7+
ms.topic: conceptual
8+
ms.custom: canvas
9+
ms.reviewer: nabuthuk
10+
ms.date: 10/30/2020
11+
ms.author: emcoope
12+
search.audienceType:
13+
- maker
14+
search.app:
15+
- PowerApps
16+
---
17+
18+
# Building responsive apps
19+
20+
[This article is pre-release documentation and is subject to change.]
21+
22+
Responsiveness refers to the ability of an app to automatically align to different screen sizes and form factors to use the available screen space sensibly, providing great UI and UX in every device, form factor, and screen size.
23+
24+
> [!IMPORTANT]
25+
> - This feature is in public preview. For more information, see [Experimental and preview features](working-with-experimental-preview.md).
26+
> - Preview features aren’t meant for production use and may have restricted functionality. These features are available before an official release so that customers can get early access and provide feedback.
27+
28+
Responsiveness allows different elements of the app to specify how they:
29+
30+
- Stretch or resize with the screen size changes.
31+
32+
- Maintain or change positions with the screen size changes.
33+
34+
## Why should you build responsive apps
35+
36+
End users can access your app from different devices such as phones, tablets, laptops, and desktops with large monitors, different screen sizes, and with varied number of pixels.
37+
38+
To ensure great user experience and usability of the app on each form factor and device, designing the app with responsive design principles is necessary. Even if the app is intended to be used only on the web browser or on mobile phones, user device screen sizes can be different, so designing the app with responsive principles is a good idea.
39+
40+
## Designing the app with responsiveness principles
41+
42+
Before you start designing the UI for your app, you need to consider the following aspects:
43+
44+
- What form factors or devices do you want to support.
45+
46+
- How the app should look on each form factor?
47+
48+
- What elements of the app need to stretch or resize?
49+
50+
- Are the elements hidden on some form factors?
51+
52+
- Does the app behave different in some form factors?
53+
54+
Once all these requirements are gathered, you should start thinking about how these different UI layouts can be created in a single application with the responsive tools available in Power Apps.
55+
56+
Before you start using the responsive layouts, you need to do the following:
57+
58+
1. Go to [Power Apps](https://make.powerapps.com).
59+
1. Open the app where you want to use the responsive layout.
60+
1. Go to **File** > **Settings** > **Screen size & orientation** to disable **Scale to fit**, **Lock aspect ratio**, and **Lock orientation** and select **Apply**.
61+
62+
> [!div class="mx-imgBorder"]
63+
> ![Settings disable lock orientation](media/create-responsive-layout/settings-disable-lock-orientation.png "Settings disable lock orientation")
64+
65+
## Responsive layouts
66+
67+
The following responsive layouts can be created by adding a new screen and selecting the appropriate option from the **Layout** tab:
68+
69+
> [!div class="mx-imgBorder"]
70+
> ![Screen layouts](media/create-responsive-layout/different-screen-layouts.png "Screen layouts")
71+
72+
> [!NOTE]
73+
> The new responsive layouts are available to the apps formats but the new screen templates are available only for **Tablet** format.
74+
75+
### Split-screen
76+
77+
The Split-screen layout has two sections, each occupying 50% width of the screen on desktops. On mobile devices, the sections are placed one below the other, each occupying up the entire screen width.
78+
79+
### Sidebar
80+
81+
The Sidebar layout has a fixed width sidebar on the left. The main body consists of a fixed height header, and the main section takes up the rest of the screen width. By default, the template has the same behavior on mobile, however some customizations are recommended based on the UI pattern desired for the mobile experience.
82+
83+
## Working with containers
84+
85+
Containers are building blocks of all the responsive design. A container can be an [auto-layout container](#auto-layout-containers) in vertical or horizontal direction, or a fixed-layout container, which in the future will support constraints.
86+
87+
Below are some tips for building your app’s UI with containers:
88+
89+
- Always create UI elements that form a UI entity inside a container.
90+
91+
- Allows the container to have its own responsive properties and settings to specify how it is positioned or resized on different screen sizes.
92+
93+
- Allows you to change how its child components are laid out with respect to responsiveness.
94+
95+
Choose one of two layout modes for a container: Manual layout or auto-layout (Horizontal or Vertical)
96+
97+
## Auto-layout containers
98+
99+
Two controls, [Horizontal container](controls/control-horizontal-container.md) and [Vertical container](controls/control-vertical-container.md) can be used to automatically lay out the child components. These containers determine the position of the child components so that you never have to set X, Y for a component inside the container. Also, it can distribute the available space to its child components based on the settings, as well as determines both the vertical and horizontal alignment of the child components.
100+
101+
### When to use auto-layout containers
102+
103+
You can use auto-layout containers in the following scenarios:
104+
105+
- UI needs to be responsive to screen size or form factor changes.
106+
- There is more than one child component that needs to resize or move around based on the screen size or form factor changes.
107+
- When you need to stack items vertically or horizontally (regardless of their size).
108+
- When you need to space items evenly on the screen.
109+
110+
### Example for auto-layout container
111+
112+
To build a responsive screen:
113+
114+
1. Sign in to [Power Apps](https://make.powerapps.com).
115+
1. Select **Apps** from left navigation. Select the **New app** drop-down menu and then select **Canvas**.
116+
1. On the **Blank app** tile, select **Tablet layout**.
117+
1. Select **File** > **Settings** > **Screen size + orientation** and disable **Scale to fit**, **Lock aspect ratio**, and **Lock orientation** and select **Apply**.
118+
1. Now from the **Insert** panes in the left sidebar, under **Layout** tab, select **Horizontal container**.
119+
120+
> [!div class="mx-imgBorder"]
121+
> ![Insert containers](media/create-responsive-layout/insert-containers.png "Insert containers")
122+
123+
1. The top-most container needs to be sized to take the entire space with these properties. It will be the same size as the screen as it resizes.
124+
1. X = 0
125+
1. Y= 0
126+
1. Width = Parent.Width
127+
1. Height = Parent. Height
128+
129+
1. Now, from the **Insert** pane add two **Vertical containers** into the Horizontal container.
130+
131+
> [!div class="mx-imgBorder"]
132+
> ![Add vertical containers](media/create-responsive-layout/add-two-vertical-containers.png "Add vertical containers")
133+
134+
1. To make the containers, fill the full vertical space, Select **Container1** and set the `Align (vertical)` property to `Stretch`.
135+
136+
> [!div class="mx-imgBorder"]
137+
> ![Align stretch](media/create-responsive-layout/align-property-stretch.png "Align stretch")
138+
139+
1. To divide the screen between the content, use the `Fill portions` property on the two child containers. The left container will take up 1/4 of the screen space.
140+
1. Select **Container2**. You'll see that the `Flexible width` property is turned on. Set the `Fill portions` to 1.
141+
1. Select **Container3**. You'll see that the `Flexible width` property is turned on. Set the `Fill portions` to 3.
142+
1. Select **Container2**. Set the `Fill = RGBA(56, 96, 178, 1)` property in the formula bar. Set `Align (horizontal)` to `Stretch`.
143+
1. Add few buttons to create a menu. Rename the buttons as needed.
144+
145+
> [!div class="mx-imgBorder"]
146+
> ![Add buttons](media/create-responsive-layout/add-buttons-to-container.png "Add buttons")
147+
148+
1. Select **Container3** and add a Horizontal container and turn off the `Flexible height` property. Set `Height` to 100. Set `Align (vertical)` to `Stretch`.
149+
1. Add some **Icons** into **Container4**. Change the icons to be different with the icon property.
150+
151+
> [!div class="mx-imgBorder"]
152+
> ![Add icons](media/create-responsive-layout/add-icons-to-container.png "Add icons")
153+
154+
1. Select **Container4**. Set the `Justify (horizontal)` property to `End`. Set the `Align (vertical)` to `Center`. Set `Gap` to 40 to create space between the icons.
155+
1. Select **Container3**. Set `Align (horizontal)` to `Stretch`. Set `Vertical Overflow` to `Scroll`.
156+
1. Add different **Label**, **Inputs**, **Media** until they extend beyond the container. Change the color of the rectangles to be different. You'll see a scroll bar to access the unseen content.
157+
158+
> [!div class="mx-imgBorder"]
159+
> ![Add different inputs](media/create-responsive-layout/add-different-inputs-media-icons.png "Add different inputs")
160+
161+
1. Select Preview or F5. Change the size of the browser window to see how your app adjusts to different screen sizes.
162+
163+
## Known issues
164+
165+
- Certain combinations of layout container properties are incompatible or can produce undesirable outputs, for example:
166+
- If the container’s `Wrap` property is enabled, the `Align` property setting is ignored on child controls.
167+
- If the container’s `Wrap` property is disabled and the container’s primary-axis overflow is set to **Scroll** (Horizontal Overflow for Horizontal containers or Vertical Overflow for Vertical containers), it is recommended to set the `Justify` property to either **Start** or **Space Between**.
168+
- The **Center** or **End** options can cause child controls inaccessible when the container is too small to display all the controls, even though the `Overflow` property is set to **Scroll**.
169+
170+
- You can’t resize or reposition the controls on the canvas app because the drag & drop controls are disabled in the layout containers. Instead, use the layout container properties to achieve the desired size and positioning. Control ordering can be changed via the **Tree view**, or by using the arrow keys as shortcuts.
171+
172+
- The **Data table**, **Charts**, and **Add Picture** controls are currently not supported in the layout containers.
173+
174+
- Some of the layout containers properties are hidden for child controls. The hidden properties can still be accessible via the formula bar or from the advanced panel. However, these properties will be ignored even if they are set in these places.
175+
176+
- When controls are moved into a layout container (for example, when copy or pasting the controls), they are inserted into the container by their order in the **Tree view**.
177+
178+
## See also
179+
180+
[Create responsive layouts](create-responsive-layout.md)

powerapps-docs/maker/canvas-apps/controls/control-container.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ search.audienceType:
1414
search.app:
1515
- PowerApps
1616
---
17-
# Container control in Power Apps (experimental)
17+
# Container control in Power Apps (preview)
1818
Provides the ability to create hierarchy.
1919

2020
> [!IMPORTANT]
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
title: 'Horizontal container: reference | Microsoft Docs'
3+
description: Information, including properties and examples, about the Horizontal container control
4+
author: emcoope-msft
5+
manager: kvivek
6+
ms.service: powerapps
7+
ms.topic: reference
8+
ms.custom: canvas
9+
ms.reviewer: nabuthuk
10+
ms.date: 10/30/2020
11+
ms.author: emcoope
12+
search.audienceType:
13+
- maker
14+
search.app:
15+
- PowerApps
16+
---
17+
# Horizontal container control
18+
19+
Horizontal container control determines the position of the child components so that you never have to set X, Y for a component inside the container.
20+
21+
## Description
22+
23+
**Horizontal** container control distributes the available space to its child components based on the settings, as well as determines alignment of the child components.
24+
25+
## Properties
26+
27+
**[BorderColor](properties-color-border.md)** – The color of a control's border.
28+
29+
**[BorderStyle](properties-color-border.md)** – Whether a control's border is **Solid**, **Dashed**, **Dotted**, or **None**.
30+
31+
**[BorderThickness](properties-color-border.md)** – The thickness of a control's border.
32+
33+
**[Color](properties-color-border.md)** - The color of the container control.
34+
35+
**[Fill](properties-color-border.md)** – The background color of a control.
36+
37+
**[Height](properties-size-___location.md)** – The distance between a control's top and bottom edges.
38+
39+
**Direction** - Defines in what direction the container layouts its child components. **Horizontal** and **Vertical**.
40+
41+
**Justify (vertical)** - Defines how child elements are aligned with the primary axis. **Start**, **End**, **Center**, **Space Between**.
42+
43+
**Align (Horizontal)** - Defines how child components are positioned in the container, in the off axis (opposite from `LayoutDirection`). **Start**, **Center**, **End**, **Stretch**.
44+
45+
**Gap** - Defines the space between containers child components in pixels.
46+
47+
**Horizontal Overflow** - Defines whether the container shows scrollbars or remove content when it is too large to fit. **Scroll** and **Hide**.
48+
49+
**Vertical Overflow** - Defines whether the container shows scrollbars or remove content when it is too large to fit. **Scroll** and **Hide**.
50+
51+
**Wrap** - Defines whether the content wraps to a new row or column when it cannot fit.
52+
53+
**Align in container** - Defines how the individual component is aligned to the parent. The default value, **Set by container**, inherits the value from the parent’s `LayoutAlignItems` property, while other properties can be used to customize the alignment for the individual child component. **Set by container**, **Start**, **End**, **Center**, and **Stretch**.
54+
55+
**Fill portions** - Defines how the individual component grows when there is more screen real-estate assigned to its parent. The number represents the portion of the extra space given to the component out of all the available extra space claimed by children of its parent. For example, if child A has `Fill portions` set to 1 and child B has `Fill portions` set to 2, child A gets 1/3 of the extra space available while child B gets 2/3 of the extra available space.
56+
57+
**Minimum width** - Represent the minimum size of the component in the direction of the `Fill portions` (that is, the parent’s `Direction`).
58+
59+
**[PaddingBottom](properties-size-___location.md)** – The distance between text in a control and the bottom edge of that control.
60+
61+
**[PaddingLeft](properties-size-___location.md)** – The distance between text in a control and the left edge of that control.
62+
63+
**[PaddingRight](properties-size-___location.md)** – The distance between text in a control and the right edge of that control.
64+
65+
**[PaddingTop](properties-size-___location.md)** – The distance between text in a control and the top edge of that control.
66+
67+
**[Visible](properties-core.md)** – Whether a control appears or is hidden.
68+
69+
**[Width](properties-size-___location.md)** – The distance between a control's left and right edges.
70+
71+
**[X](properties-size-___location.md)** – The distance between the left edge of a control and the left edge of its parent container (screen if no parent container).
72+
73+
**[Y](properties-size-___location.md)** – The distance between the top edge of a control and the top edge of the parent container (screen if no parent container).
74+
75+
76+
## Example
77+
78+
1. Sign in to [Power Apps](https://make.powerapps.com).
79+
1. Select **Apps** from left navigation. Select the **New app** drop-down menu and then select **Canvas**.
80+
1. On the **Blank app** tile, select **Tablet layout**.
81+
1. Select **File** > **Settings** > **Screen size + orientation** and disable **Scale to fit**, **Lock aspect ratio**, and **Lock orientation** and select **Apply**.
82+
1. Now from the **Insert** panes in the left sidebar, under **Layout** tab, select **Horizontal container**.
83+
84+
> [!div class="mx-imgBorder"]
85+
> ![Insert containers](../media/create-responsive-layout/insert-containers.png "Insert containers")
86+
87+
1. Set the following properties to occupy the full available space of the screen:
88+
1. X = 0
89+
1. Y= 0
90+
1. Width = Parent.Width
91+
1. Height = Parent. Height
92+
93+
1. Add few buttons, text inputs, media, icons, and select **F5** to see how the app adjusts to the screen changes.

0 commit comments

Comments
 (0)