Introduction
Responsiveness is a key feature of any app and there are many elements in an app that need to be responsive e.g. a pop-up. One of the sample apps I created for Microsoft Teams is Profile+ (code can be found here). It is an app that shows organization structure for a selected user and also shows the list of team members in a team. We will use the filter section of the team members view to illustrate how to build a responsive pop-up using layout containers. The focus will be on the UI and not on how to implement a filter.
PS: I prefer traditional containers over layout containers 9 out of 10 times. There is something very satisfying about writing mathematical expressions for the different properties for various controls. However, I wanted to illustrate that if you are not a fan of writing mathematical expressions, here is an alternate way of doing it.
Responsive pop-up using layout containers
Add the following controls to create a responsive pop-up using layout containers
- A label
- Name: lblFilterOverlay
- X: 0
- Y: 0
- Width: Parent.Width
- Height: Parent.Height
- Text: ""
- Fill: RGBA(0, 0, 0, 0.4)
- A vertical layout container
- Name: conFilter
- X: (Parent.Width - Self.Width) / 2
- Y: (Parent.Height - Self.Height) / 2
- Width: Min(600, Parent.Width - 40)
- Height: 200
- Fill: RGBA(255, 255, 255, 1)
- Justify (LayoutJustifyContent): LayoutJustifyContent.Start
- Align (LayoutAlignItems): LayoutAlignItems.Stretch
- PaddingTop: 20
- PaddingLeft: 20
- PaddingRight: 20
- DropShadow: DropShadow.Bold
- A label inside the vertical container
- Name: lblFilterHeader
- Text: "Filter - Title"
- A combo box inside the vertical container
- Name: cmbFilter
- Items: as needed
- A horizontal container inside the vertical container
- Name: conActionButtons
- Justify: LayoutJustifyContent.End
- Align: LayoutAlignItems.Start
- A button inside the horizontal container
- Name: btnClearFilter
- Text: "Clear"
- OnSelect: Reset(cmbFilterOptions); UpdateContext({locViewFilter: false})
- Another button inside the horizontal container
- Name: btnApplyFilter
- Text: "Apply"
- OnSelect: UpdateContext({locFilter: cmbFilterOptions.Selected.Value, locViewFilter: false})
- Set the Visible property of the vertical container and lblFilterOverlay label to locViewFilter
- Add an icon which will be used to display the filter pop-up
- Name: icnFilter
- Icon: If(IsBlank(cmbFilterOptions.Selected.Value),Icon.FilterFlat, Icon.FilterFlatFilled)
- OnSelect: UpdateContext({locViewFilter: true})
Here is a demo:
PS: Notice the drop shadow of the pop-up. Even though I don't like layout containers, I have to say that I love the drop shadow!
2 thoughts on “How to create a responsive pop-up using layout containers”