Bubble Docs

Building responsive pages

Parent-child relationships

As we explored in the section about Bubble elements, the design of your app consists of a hierarchy of parent-child relationships. The page itself is the parent of all other elements, and on that page you can place Containers that become the parent of elements inside it.
In this example, the group that contains all the other elements is the parent and the input fields and button are all children of that group.
Containers can also contain containers, making the former the parent of the latter and you can build as many levels of this parent-child relationship as you need. This makes up the basis for the building responsive pages.
In this guide we will illustrate the parent container with a dashed border, as exemplified below:
The parent container will be highlighted with a dashed line throughout this guide.

Parent settings and element settings

Setting up the responsive behavior of a given element is done by mixing the settings on the parent container and the element itself. If the element is placed directly on the page, that page is the parent container, but if you place it into a container element, the settings on that element will affect all its child elements.
The settings on the parent container determines where the elements are positioned relative to the container and each other. For example, they can be positioned vertically (in rows) or horizontally (in columns). The settings on the container is also used to determine the alignment of the overall layout (such as determinging whether a row should start on the left or right side of the container), the total dimensions of all the content and the spacing between rows and columns
The settings on the child elements determines the layout settings to that element in particular: how tall and wide should it be? How much room should the element maintain around and inside of itself (padding and margin) relative to the parent element and sibling elements?

Container layout settings

Each container element (including the page itself) has a Layout setting, and this setting controls the behavior of all the elements inside of it. You can see the different Layouts as a set of rules that tells the children inside of it how to position themselves.
The container layout is located in the Layout tab of the Property Editor for the container (parent) element.
Their position then is based on three factors:
  • The layout setting of the parent container
  • The layout settings on the element itself
  • The settings and position of its sibling elements (the other elements inside of the same container)
There are four types of layouts on the container elements:
  • Fixed
  • Align to Parent
  • Column
  • Row

Fixed layout

Fixed layout lets you move and place an element freely within the parent container and it will position itself on that point. The position is set in an absolute X and Y pixel value, and the size of the element in a W(idth) and H(eight) value.
The position is relative to the parent element: in other words, the element will be positioned exactly X and Y pixels from the top left corner of the parent container.
In the animation below you can see that the button can be positioned freely in the parent element. The red outline on the parent group container indicates that the element will be (remain in this case) a child of that group.
Fixed layout lets you set an absolute X and Y position using drag and drop.
The use of fixed layout can be useful in certain scenarios but can be a bit more challenging to manage on different screen sizes and resolutions.
The four values highlighted above determine the element's width, height, X position and Y position .

Parent and child layout settings (fixed layout)

Parent Layout Controls


Child Layout Controls

  • Width and Height

Align to parent layout

Align to parent divides the parent element into a nine-cell grid and lets you align child elements to any of the cells. In the illustration below you can see how a rectangular group is divided into upper-left, upper-middle, upper-right and so forth.
The Align to parent layout lets you align child elements to one of the cells in a nine-cell grid.
If you create a new child element or drag and drop one, it will automatically snap to the nearest cell:
You can also control the position of the element by opening the Property Editor for the child element. Each of the arrows below represent the different cells of the parent container:

Multiple elements

If you want to place multiple elements in the same cell, such as the top left, you may find that the elements overlap. If you want them to align themselves relative to each other, you can place them within a second group and set a different layout for that group.

Parent and child layout settings (align to parent layout)

Parent Layout Controls


Child Layout Controls

  • Pin to specific cell
  • Width and Height.

Row layout

Child elements in a row container are aligned one after the other horizontally. The child elements will wrap as the screen is resized or the total width of the elements exceeds the parent containers width.
Each element added to a row layout will be positioned at the end of the row, and wrap if the total width of the child elements exceeds the width of their parent container.
New child elements drawn inside the container will be added to the end of the list by default but can be re-ordered using the order controls or by dragging and dropping.
Elements can be reordered by dragging and dropping or by using the buttons in the Property Editor.

Parent and child layout settings (row layout)

Parent Layout Controls

  • Container Alignment
  • Row gap
  • Column gap

Child Layout Controls

  • Vertical Alignment
  • Order Selection
  • Width and Height.

Column layout

Child elements in a column layout will be place on top of each other, regardless of the width they take up:
Each element will be placed at the bottom of the column.
In the example above, the parent group is set to stretch as the content of it expands. As more and more elements are made visible, the height of the group increases automatically:
For the Fit height to content setting to work as expected, the minimum and maximum height must be set accordingly.

Parent and child layout settings (column layout)

Parent Controls

  • Row gap

Child Controls

  • Horizontal Alignment
  • Order Selection
  • Width and Height


In row and column layout, you can set the alignment of child elements: where should the row or column start? For example, in a column layout the child elements stack on top of each other: should that stack start at the bottom or at the top of the container element?
Alignment is used both to determine the element's starting position, and how they should be spread out across the parent container.
You can read more about each individual layout setting in our core reference article about row and column layouts. You'll find the section about rows here and columns here.

Element layout settings

In the above section we covered how a container's layout settings affect its child elements. In this part we'll have a look at how the settings on each individual child element is used.
An element's alignment properties determine how the element should be positioned within the constrainta set by its parent container.
In short the element settings are used to control the behavior of that specific element, as opposed to the container layout settings that affect all child elements. On the element you can set stuff like:
  • How wide should the element be?
    • No restriction
    • Fixed width
    • Minimum/maximum width
    • Stretch with content
  • How tall should the element be?
    • No restrictions
    • Fixed height
    • Minimum/maximum height
    • Stretch with content
  • How should the element be aligned relative to the parent containers layout
  • Should the element collapse its width/height when its hidden?
  • Margin/Padding
As you can see from the settings, this gives you the freedom to control how individual elements behave within the constraints you have set on the parent container.
The container's layut setting is column, making the child elements stack vertically. But their width is set on an element level, as illustrated in the example above.

Using the Responsive Viewer

You will find a tab above the New Element palette that lets you switch between the UI Builder view, where you can modify elements, drag new ones, and delete some, and the Responsive Viewer which lets you test how your page behaves as the screen width changes. In this view, the ruler at the top of the page area defines the current page width. Just click or drag on the ruler to resize the page and see how the page behaves dynamically.
You can also use the preset width icons on the left side of the screen to see how the page looks on iPhone in portrait mode, in landscape mode, on an iPad and on a laptop or a desktop.
When you click on an element, the Layout tab in the Property Editor will display the different parameters you can modify to affect its behavior.