Containers
Containers are elements that hold other elements and control their layout and data. Learn about the container types, layout modes, loading data into containers, and styling them.

Containers hold other elements and control how they behave on the page. Placing an element inside a container makes the container its parent and the element its child, forming the hierarchical structure the browser uses to render the layout correctly. You can see this parent-child relationship in the element tree.
Containers are one of the most important tools in Bubble. They control layout, hold data, group related elements, and are the foundation of any responsive design. Once you know how containers work, the rest of Bubble's design tools become much easier to use.
What containers do
Containers serve three main purposes:
They organize elements into a hierarchy. Grouping related elements together makes them easier to manage, move, style, and reference.
They control layout. A container's layout properties determine how its child elements are arranged and how they respond to different screen sizes.
They hold data. A container can be given a data source, making that data available to every element inside it.
Most containers do more than one of these at the same time. A single group might hold a form's fields, control their layout, and load the user record being edited, all in one.
Container types
Bubble offers several container types on web, each suited to different situations.
The most common container. Used to organize elements, control layout, and hold data.
Displays a list of items by repeating a template cell for each record.
Displays a list of items in a structured table.
An overlay that appears on top of the page, typically for dialogs or focused interactions.
A container that stays fixed in place on the screen as the user scrolls, often used for headers or persistent menus.
A small overlay anchored to another element, typically used for dropdown menus or contextual actions.
Controlling layout with containers
Containers use one of four layout modes to arrange their children:
Column stacks children vertically. Each element sits below the previous one.
Row arranges children horizontally, side by side.
Align lets you position children in one of nine fixed positions within the container.
Fixed gives each element a fixed position, without automatic layout logic.
Each layout mode comes with its own set of alignment and spacing options. Choosing the right layout mode is one of the most important decisions when building a responsive design. You can also nest containers inside other containers.
Using containers to control layout is the key to an efficient responsive design.
Article series: Responsive design
Loading data into containers
Containers can hold data, which makes it available to every element inside them.
For example, a form for editing a user might have a container with its data source set to Current User. Every input field inside that container can then reference Parent group's User's name, Parent group's User's email, and so on, without needing to fetch the user separately in each element.
Two ways to load data
There are two main ways to load data into a container:
Set the container's data source
Setting a container's data source makes the data load instantly. First, you need to set the Type of content, such as User. This tells Bubble what kind of data to expect, and the container will only accept that type. Then set the Data source itself, such as Current User.
Current User is just one option. Any expression that returns a user is valid, such as Do a search for:first item, as long as the search returns a user.
The data loads automatically when the page loads. This is useful for data that's known upfront, like the current user or the current page thing.

User, and the expression that loads the user into the form is Current User.In containers that handle multiple things, like a repeating group, you follow the same logic. Any expression that returns a list of users will be accepted:

Push data with a workflow
Use the Display data in a group/popup and Display list in a repeating group actions to load data into a container in response to a user action. This is useful when the data depends on something the user does, like clicking a specific item in a list.

Both methods make the data available to child elements. The choice comes down to whether the data should load immediately or in response to something the user does.
Referencing data in elements
Once a container holds data, its child elements can reference it directly. In the properties of a child element, use expressions like Parent group's User's email to pull data from the container.

This makes containers a powerful way to structure a page: load the data once at the container level, then reference it from wherever it's needed inside.
Referencing data in workflows
The same works in workflows. A Save button inside a container holding a user can reference Parent group's User directly, making it easy to save changes back to that user.

Parent group's User to make changes to it.For this to work, the workflow must be triggered by an element inside the container. If a Save button sits outside the container, it won't have access to the container's data through the Parent group's thing expression, but you can still reference the container by name to get its data.
This pattern works with any container type, including cells inside a repeating group.
Resetting a container
Resetting a container reverts it to its original state. The Reset a group/popup action clears the current data and restores the data source defined at the container level.
Whenever the content of a container changes, either through a data source update or a workflow, all child elements update to reflect the new data.
Styling containers
Containers can be styled just like any other element. They support background colors, borders, border radius, shadows, opacity, and more. They can also be set to fully transparent or invisible when their only purpose is to control layout or hold data.
To open a container's styling properties, click on it in the element tree or on the canvas. Its properties appear in the element property editor on the right.

Using shared styles or style variables keeps container styling consistent across your app.
Article: Styles
Working with containers in the editor
A few tips make working with containers easier:
Use the element tree to navigate parent-child relationships. It's the fastest way to select a specific container in a complex design.
Give containers meaningful names. Group Header and Group Cart Items are much easier to work with than Group A and Group B.
Nest carefully. Nested containers make responsive design more flexible, but excessive nesting can slow down rendering and make the layout more difficult to manage.
Consider reusable elements. If the same container structure appears in multiple places, converting it into a reusable element saves time and keeps the design consistent.
Container security
Like all elements, containers become part of your app's client-side code. Their names, structure, and any static content are visible to anyone inspecting the page. Sensitive information should never be placed inside a container's properties, data source expressions, or default values. Protect sensitive data with privacy rules in the database instead.
FAQ: Web containers
Last updated
Was this helpful?