Skip to main content

Containers and responsive layout

A container groups elements and controls their flow, spacing, alignment, appearance, and scrolling. The page arranges its containers; each container arranges its own elements. Start with this structure before adjusting individual controls.

The examples below show the visual editor in VS Code and NG Live Preview. Their buttons demonstrate layout; navigation and hardware actions must be configured separately.

Add and configure a container​

  1. Open a saved .page file in the visual editor.
  2. Run AVstudio: Add container, or use Add container from the canvas context menu.
  3. Select the container and open Container Properties.
  4. Give it a useful name, such as Header, RoomControls, or SourceList.
  5. Configure its layout, then add elements inside it using Add element.
  6. Save and open Open Live Preview (Browser) to inspect the result.

For the illustrated insertion workflow, see Add components to a project. Select the container itself when changing its layout; selecting a Button or Slider opens that element's properties instead.

Understand the two layout levels​

LevelWhat it arrangesExample
Page flowTop-level containersStack a header above content, or place a sidebar beside content
Container flowElements within one containerPlace source buttons in a row or stack menu buttons vertically

A column page can contain a row header and a column content area. The directions are independent.

All containers belong directly to the page's containers array. A container's elements array contains elements, not other containers. If one area needs a more complex internal layout, embed a Subpage that has its own containers.

Flow, alignment, and distribution​

Choose Horizontal or Vertical flow​

  • Horizontal (Row) lays out elements side by side. It suits a toolbar, source selector, or a group of adjacent controls.
  • Vertical (Column) stacks elements from top to bottom. It suits a menu, settings panel, or list of controls.

The screenshots below show the current controls in VS Code. Open Container Flow Demo.page in the sample project to follow along. Its responsive page stacks two containers; each holds the same Audio, Video, and Lights buttons, sized 150 × 60 px.

  1. Select the upper container on the canvas and open Container Properties from the Activity Bar. Check Container name reads Row controls.
  2. Expand Container layout. Under Flow, select Horizontal.
  3. Set Align and Distribution to Center, and Gap between elements to 16 px. The buttons form a centered row.

VS Code Container Properties with Row controls selected, Horizontal flow active, Center alignment and distribution, and a 16 px gap beside the horizontal button row

Horizontal flow: the selected upper container places Audio, Video, and Lights side by side. The sidebar shows the settings that produce this arrangement.

  1. Select the lower container. Check Container name reads Column controls.
  2. Under Flow, select Vertical. Keep Align, Distribution, and Gap between elements unchanged. The same buttons now form a centered column.

VS Code Container Properties with Column controls selected and Vertical flow active beside the stacked Audio, Video, and Lights buttons

Vertical flow: the lower container stacks the same buttons. Align centers them horizontally; Distribution centers the group vertically.

To see the change directly, switch the lower container to Horizontal, then back to Vertical. Its buttons rearrange without changing their size or order. Save the page when finished. The page's flow arranges the containers; each container's Flow arranges its own elements.

Align across the flow​

Alignment (align) controls the axis perpendicular to the flow:

AlignmentIn a RowIn a Column
flex-startAlign to the topAlign to the left
centerCenter verticallyCenter horizontally
flex-endAlign to the bottomAlign to the right
stretchLet eligible elements fill the available heightLet eligible elements fill the available width

An explicitly sized element can prevent the stretching you expect. Check the element's width, height, and minimum/maximum limits when it does not follow the container alignment.

Distribute along the flow​

Distribution (distribution) controls the direction in which the elements are arranged:

DistributionBehavior
flex-startGroup items at the beginning: left in a row, top in a column
centerCenter the group
flex-endGroup items at the end: right in a row, bottom in a column
space-betweenPut the first and last items at opposite ends and distribute remaining space between items
space-aroundDistribute space around the items

For a header with a title and a Home button, use Row, alignment Center, and distribution Space between. For a vertical list that can overflow, use Column and distribution Start so its beginning remains easy to reach.

Spacing: page gap, container gap, and padding​

SettingSpace it controlsTypical use
Page gapBetween containersSeparate the sidebar and content regions
Container gapBetween elements in that containerGive a row of buttons consistent separation
Container paddingBetween the container edge and its contentKeep controls away from borders and screen edges
Spacer elementOne specific gap or decorative shapeSeparate two groups or draw a divider

Use the parent container's gap for repeated spacing. A Spacer is useful when a particular gap differs from the others.

For example:

Set Gap to 16 px, all-sides padding to 24 px, and top and bottom padding to 12 px in Container Properties.

The side-specific padding values override the all-sides value. This example uses 24 px on the left and right, and 12 px on the top and bottom.

Compose a responsive page​

A responsive page fills the viewport. Divide that space into containers that either share available space or keep a manual size.

Sizing choiceConfigurationSuitable regions
FlexibleLeave container size unsetMain content, equal columns, lists
ManualSet size and enable manual modeA fixed-height header or fixed-width sidebar

The size direction comes from the page flow:

  • In a column page, a manual container size determines its height.
  • In a row page, a manual container size determines its width.

Manually sized containers take their space first. Flexible siblings share the remainder. Two flexible containers can form equal columns without calculating percentages.

Manual size must be enabled

A saved size.value is not enough. The size takes effect only when size.manualMode is true. When manual mode is false or absent, the container remains flexible and the saved size value is ignored at runtime.

Do not derive every container dimension from one panel resolution. Reserve manual sizing for regions that need it, and let the content use the remaining space.

Example: fixed header and flexible content​

Build the structure​

Open Header Scroll Demo.page in the sample project to inspect this example in VS Code, or build it as follows:

  1. Set the page layout to Responsive and page flow to Vertical (Column).
  2. Add two containers named Header and Content.
  3. Set the page gap to 16 px.
  4. Select Header, open Container Properties → Container layout, choose Size → Manual, and enter 80 px.
  5. Select Content and choose Size → Auto so it fills the remaining height.
  6. Put a title and Home button in the header; add the main controls to Content.

Configure the header​

Select the header on the canvas and check Container name is Header. Set Flow → Horizontal, Align → Center, and Distribution → Between. The title stays on the left and the Home button on the right. The example uses a 64 px high button with 8 px padding above and below, fitting within the 80 px header.

Set Header to a manual size of 80 px and apply 8 px padding on all sides.

VS Code Container Properties showing Header with Manual size 80 px, Horizontal flow, Center alignment, and Between distribution beside the room controls page

Header selected in VS Code: Manual reserves an 80 px strip at the top of the responsive page.

Configure the content​

Select the room-list container and check Container name is Content. In Container layout, choose Size → Auto, Flow → Vertical, Align → Center, and Distribution → Start. Expand Scroll and select Scroll so controls remain reachable when the list exceeds the available height.

Set Content’s gap to 20 px and leave its container size flexible.

The flexible Content container fills the remaining height after the header and page gap.

VS Code Container Properties showing Content with Auto size, Vertical flow, Start distribution, a 20 px gap, and Scroll selected beside the room list

Content selected in VS Code: Auto uses the remaining height, while Scroll keeps the 14-button list reachable inside that region.

Scroll over the room list to reach Room 14, then return to Room 1. The header remains outside the scrolling container. Scroll inside Content when testing this behavior; panning the surrounding editor canvas moves the whole design view. Test the same list in Live Preview. These sample buttons demonstrate layout and have no navigation actions.

Use a global slot instead when the same header must appear across multiple pages. A normal header container belongs only to its own page.

Example: sidebar and two equal content columns​

Open Sidebar Columns Demo.page in the sample project to inspect this arrangement, or create a responsive page with three top-level containers: Sidebar, Audio, and Lighting.

  1. In Page Properties, set the page flow to Horizontal (Row) and the gap between containers to 16 px.
  2. Select Sidebar on the canvas and open Container Properties. Expand Container layout, choose Manual under Size, and enter 240 px. Because the page flows horizontally, this sets the sidebar's width.
  3. Set the container's Flow to Vertical, Align to Center, Distribution to Center, and Gap between elements to 16 px. Add Audio, Video, and Lights buttons.

VS Code Container Properties showing Sidebar with Manual size set to 240 px beside the sidebar and two content columns

Sidebar uses Manual sizing to keep its 240 px width. Its Vertical flow stacks the navigation buttons.

  1. Select Audio and choose Auto under Size. Use Vertical flow, Center alignment and distribution, and a 16 px element gap. Add Volume and Mute buttons.
  2. Select Lighting and apply the same settings. Add Scene 1 and Scene 2 buttons, then save the page.

VS Code Container Properties showing Audio with Auto sizing and Vertical flow beside two equal content columns and a narrow sidebar

Audio and Lighting use Auto sizing and divide the remaining width equally after the sidebar and page gaps. Changing the page width keeps Sidebar at 240 px while both content columns resize.

Check that the sidebar, gaps, and minimum content widths fit the smallest intended display. Flexible sizing distributes available space; it does not automatically transform a desktop sidebar into a mobile navigation pattern.

Size elements within a container​

Container size allocates a region of the page. Element width and height determine the controls within that region. Changing a Button's width does not change the container's sizing mode.

Use a fixed size when a control needs a particular touch area. Use a relative size with limits when it should adapt to its container:

In Element Properties, set width to 100%, maximum width to 400 px, and height to 64 px.

This element can occupy the available width up to 400 px, while keeping a 64 px height. Set these dimensions on the element; configure the container’s size separately.

An omitted element dimension or a null value leaves sizing to the renderer's default behavior. Consider label length, wrapping, padding, and touch target size together rather than forcing every control into identical dimensions.

Size and overflow​

In a responsive layout, growing content scrolls inside its container. Do not increase the page height to accommodate a long source list or log.

scrollModeResultWhen to use it
disabledOverflow is hidden and cannot be scrolledA region whose contents are guaranteed to fit
scrollScrolling with a visible scrollbarLists where users should see that more content exists
scrollHiddenScrolling with the scrollbar hiddenAn intentionally clean presentation with another clear scrolling cue

An unset scroll mode inherits the active theme's container setting. scrollbarThumbBackground accepts a CSS color or auto for native system appearance. Scrollbar thickness is native; there is no container scrollbar-size property.

Test overflow with more items than the visible area can hold. Confirm that the first and last controls are reachable and that dragging or scrolling over a control produces the intended interaction.

Appearance and theme inheritance​

Container properties can set the background, border, padding, text color, font family and size, text transformation, and wrapping. Use the theme for shared defaults, then add local overrides only where this container needs a different treatment.

Property groupWhat to check
BackgroundA color or supported background image; keep controls legible over it
BorderEnable border settings, then set width, style, color, and radius
TypographyContainer defaults can be overridden by individual elements
PaddingEnough inset for borders, labels, and touch controls
Scroll appearanceLocal scrollbar color and mode override inherited defaults

If a theme change appears to have no effect, check for an explicit value on the container and then on the element. See Themes and custom styling.

Responsive versus fixed pages​

Responsive pageFixed page
Page flow arranges containers, and container flow arranges elementsElements use explicit positioning and anchoring
Flexible regions adapt to the viewportPosition constraints determine how controls relate to the canvas edges
Start with flow, gap, alignment, and sizingStart with coordinates and horizontal/vertical constraints

The worked examples on this page are responsive. Do not apply fixed-position offsets as a substitute for responsive flow. See Pages and layouts before changing the layout mode of an existing design.

Reusable groups​

For a room card with a title row, a content region, and a footer, create a separate page with those containers, then embed it using a Subpage element. The host container holds the Subpage element; the embedded page owns its internal containers.

Use Subpage List when that card must repeat for datasource records. Use global slots for shared regions around multiple screens. See the Subpages, lists, and global slots walkthrough.

Troubleshooting​

SymptomWhat to check
Changing the saved size has no effectEnable manual mode; check whether the page flow makes size control width or height
Main content does not fill remaining spaceRemove an unintended manual size from that content container
Equal columns have unequal usable areasCompare manual sizes, padding, gaps, and the minimum dimensions of their children
Stretch does not enlarge a controlCheck the element's explicit dimension and minimum/maximum limits
Space between leaves unexpectedly large gapsDistribution spreads remaining space in addition to the configured gap; use Start or Center for a compact group
First or last list items are difficult to reachUse start distribution for the overflowing flow and check the container's Scroll setting
Content disappears beyond the edgeScroll may be disabled, or the allocated region may be too small
Scrolling works but the bar is absentCheck for scrollHidden or a theme override
A nested group renders emptyA container cannot be placed directly inside another container; use a Subpage element
Theme changes are not visibleInspect local container and element overrides
The narrow layout is crowdedReduce unnecessary manual sizes, allow suitable text wrapping, and reconsider the arrangement for that screen size

Verify the layout​

  1. Save and run Run Project Health Check.
  2. Preview wide and narrow target sizes and both orientations.
  3. Confirm headers and sidebars keep their intended size while content adapts.
  4. Test long labels, large values, and more list items than fit on screen.
  5. Scroll to the first and last controls without losing access to fixed navigation.
  6. Check padding, contrast, clipping, and touch target size.
  7. Test control actions separately; a correctly arranged button still needs its behavior configured.

Continue with the element catalog, Subpages, and Themes.

Reveal nested elements​

Version 27.0.29 adds childAnimate and childAnimateDelay for a container's element entrance cascade. Choose a preset and delay, then test the page in Live Preview; the editor canvas stays static. Element presets override the inherited choice, while an explicit none opts an element out. See Visibility and entrance animations for timing, list-item animations, and reduced-motion behavior.

Scroll snap​

Since 27.0.8, a responsive container can snap its scroll resting positions to its direct elements. In Container layout → Scroll, choose a scrollable mode, expand Scroll snap, enable it, and select Start, Center, or End alignment. Snap is off by default; saved keys are scrollSnap and scrollSnapAlign (start, center, end).

Snap does not make content overflow: prepare enough content to scroll, then test several resting positions in Live Preview. A fixed-layout container does not scroll and ignores snap; Disabled scroll hides the snap card. An inner scroller, such as a grid Subpage List, needs its own snap settings and counts as one target in the outer container. Snap has no theme keys.