---
title: Frames and auto layout
description: Frames versus groups, auto layout direction and spacing, hug, fill and fixed sizing, layout grids and masks in Brilliant.
section: editor
order: 4
featured: false
related: editor/components, editor/selection-and-editing, solutions/build-feature-ui
---

# Frames and auto layout

A frame is the container that holds elements, clips them and runs auto layout. Press <KeybindingDisplay keyCode="F" size="small" /> to draw one, or <KeybindingDisplay keyCode="F" modifiers={["cmd"]} size="small" /> to frame your selection.

## Should I use a frame or a group?

Use a frame when the container has a size or a layout of its own, and a group to move a few things as one.

| Compare | Frame | Group |
|---|---|---|
| Size | Any size | Always hugs its contents |
| Clip content | On request | No |
| Auto layout | Yes | No |
| Drag elements in and out on the canvas | Yes | No, use the layers list |
| Make one | <KeybindingDisplay keyCode="F" modifiers={["cmd"]} size="small" /> | <KeybindingDisplay keyCode="G" modifiers={["cmd"]} size="small" />, ungroup with <KeybindingDisplay keyCode="G" modifiers={["cmd", "shift"]} size="small" /> |

Give a group a fixed or fill size on either axis and Brilliant promotes it to a frame.

## How do I add auto layout?

Select the elements and press <KeybindingDisplay keyCode="A" modifiers={["shift"]} size="small" />. A single frame converts in place; anything else gets wrapped in a new auto layout frame. Brilliant reads the gap and padding from where things already sit, so nothing jumps.

<DocFigure src="/docs/images/editor/frames-and-auto-layout-layout.webp" srcMobile="/docs/images/editor/frames-and-auto-layout-layout-390.webp" stage="panel" alt="The Layout section: direction switch, alignment, spacing and padding" caption="The Layout section in the right panel." />

| Control | What it sets |
|---|---|
| Direction | Stack children horizontally or vertically. |
| Gap | The space between children, a number or auto for space-between. |
| Padding | The inset from the frame edge, per side. |
| Alignment | Where children sit along the stack and across it. |
| Wrap | Lets children flow to a new line when they run out of room. |
| Clip content | The scissors button. Crops anything past the frame edge. |

<DocsLiveEmbed kind="controls" scene="auto-layout" lead="Try it: flip the direction, gap, padding and alignment of a real frame." />

## What do hug, fill and fixed mean?

They decide who sets the size on each axis: the contents, the parent, or you.

<DocFigure src="/docs/images/diagrams/auto-layout-sizing.webp" srcMobile="/docs/images/diagrams/auto-layout-sizing-390.webp" stage="panel" alt="Three auto layout frames: a hug frame shrinks to fit its children, a fill child stretches into the leftover space, and a fixed frame keeps its size" caption="Three auto layout frames: a hug frame shrinks to fit its children, a fill child stretches into the leftover space, and a fixed frame keeps its size" />

Children set to fill share the leftover space. Give one a higher grow factor and it takes a larger share.

### How do I pin one child outside the flow?

Turn on Toggle Ignore Auto Layout for that child. It stays a child, but the frame stops counting it for spacing and sizing, and you can drag it anywhere.

## What are layout grids for?

Layout grids are guides for lining work up: columns, rows or a square grid. Add one from the Layout guides section of the right panel and set its count, size, gutter and margin. They never export. Show or hide all of them with <KeybindingDisplay keyCode="G" modifiers={["shift"]} size="small" />.

## How do masks work?

A mask clips a set of elements to the shape of the topmost one. Select two or more and press <KeybindingDisplay keyCode="M" modifiers={["cmd", "ctrl"]} size="small" />, or right-click and choose Use as Mask. Edit the shape or the content any time and the result follows.

<DocFigure src="/docs/images/diagrams/mask-before-after.webp" srcMobile="/docs/images/diagrams/mask-before-after-390.webp" stage="panel" alt="Before and after a mask: a circle over gradient artwork, then the same circle clipping the artwork to its outline" caption="Before and after a mask: a circle over gradient artwork, then the same circle clipping the artwork to its outline" />

## Where next?

- Paint your frames: [Color and fills](/docs/editor/color-and-fills).
- Turn a frame into a reusable part: [Components](/docs/editor/components).
- Select and align what is inside: [Selection and editing](/docs/editor/selection-and-editing).
- Size type inside a layout: [Text](/docs/editor/text).
