Groups & layout

Frames, hug/fixed/fill sizing, gap, alignment.

Most canvas editors treat every element as a free-floating box with an x/y position — grouping is just cosmetic. PixlDocs has a real structural layout model underneath: elements can live inside frames that auto-arrange their content, resize safely, and reflow when text grows. This page is the reference for exactly how that works — the rules stay the same whether a human is dragging things in the editor or an AI agent is constructing a template through the MCP tools.

One rule that explains almost everything

An element's position on the page is always a deterministic function of stored data — its own left/top, plus whatever container it lives inside. Nothing about how you selected it, or what you were doing a moment ago, should ever change where it renders. If the canvas ever shows something in a different spot than where it actually sits (for example, a multi-selected element that visually jumps to a strange position right after you drag it), that is a bug, not expected behavior — see the changelog for the class of bug this caused and how we test for it now.

Two ways to select more than one thing

It's easy to conflate these two, so PixlDocs draws a hard line between them:

  • Multi-select (shift-click, or drag a marquee) — a temporary selection. Move, align, or delete together, but nothing about the relationship is saved. The moment you click away, it's gone.
  • Group (select, then Group) — a permanent container node saved in the template. It remembers its children, and optionally, how they're laid out (see Frames below).

Every saved group is a frame — the right panel shows it as Frame, and its Arrange setting decides how it treats its children. Anything that's true of groups (nesting, renaming, locking) is true of frames.

Arrange: Free vs. Column / Row

Every frame picks one of three arrangements:

Free

Children keep their own explicit position inside the frame, exactly like elements on the page itself. Moving or resizing one child never affects its siblings. Free frames are the only kind that can be rotated as a unit.

Column / Row

Children automatically flow one after another — top-to-bottom (Column) or left-to-right (Row) — with a consistent gap between them. When content grows, everything after it moves along — nothing overlaps. This is PixlDocs' auto-layout.

The one thing that trips people up
Inside a frame, you can't drag a child past its neighbor along the flow direction — that position is always computed from order + gap + padding, not from where you last dropped it. To move something earlier or later, reorder it in the layers list. The cross-axis position (how it sits side-to-side in a vertical frame, or up-and-down in a horizontal one) can still be nudged manually, unless alignment is set to stretch it.

Sizing a frame: Fits content vs. Fixed, and Grow to fill

  • Fits content — the frame has no size of its own; it always shrinks or grows to fit exactly around its children, like width: auto in CSS.
  • Fixed size — the frame has an explicit width and height. Children are placed inside it according to alignment, and any leftover space is just empty — unless a child is set to grow.
  • Grow to fill — a checkbox on any child of a Column/Row (in the right panel). The child expands to absorb the frame's leftover space along the flow axis (the same idea as CSS flex-grow). The classic resume pattern: in a Row, set the middle item to grow and the last item is pushed to the far edge — job title left, dates right.

Cross-axis sizing works the same way through alignment: setting a child's alignment to stretch makes it fill the frame's width (in a vertical frame) or height (in a horizontal one) instead of sitting at its own natural size.

Spacing: gap, padding, margin

  • Gap — the space between every consecutive pair of children in a frame.
  • Padding (top/right/bottom/left) — inset from the frame's own edge, before the first child and after the last.
  • Margin (per child, per side) — a one-off nudge for just that child, added on top of the shared gap. Use this instead of dragging a child off its flow position — a drag along the main axis is ignored, but margin is a real, saved offset.

Alignment: justify & align

  • Justify — how children are spread out along the flow axis: start, center, end, or one of the space-between/around/evenly distributions. Only has room to do anything when the frame has a fixed size on that axis — a hug frame has no extra space to distribute.
  • Align — how children line up across the flow axis: start, center, end, or stretch. Any child can override the frame's align just for itself.

Nesting

Frames can contain other frames — a horizontal frame of vertical frames gets you a row of independently-stacked columns, for example. Sizing and alignment are resolved per level, so a hug frame nested inside a fixed frame shrinks to its own content while still being positioned by its parent's alignment rule.

What's not built yet

Being upfront about the edges of the current system, so you don't design around a capability that isn't there:

  • No 2D grid layout (auto-wrapping into rows and columns) yet — only single-axis frames.
  • Resizing a free-form group's box doesn't reflow or constrain its children yet — repositioning them is still manual. This only affects free-form groups; frames always reflow their children.
  • Rotation is only supported on free-form groups — a frame can't be rotated as a whole yet.
  • Grouping or ungrouping a selection that includes a rotated element can shift it by a fraction of a pixel today, since the bounding-box math used at group/ungroup time is axis-aligned. Usually invisible, but worth a quick check after regrouping a rotated composition.

Why this matters beyond the editor

A pixel-position-only model can't be described by an agent — there's no structure to target, only coordinates to guess. Because PixlDocs' frames are a real, inspectable model (hug/fixed/fill sizing, gap, alignment, nesting), a tool-calling AI can construct or edit a layout by describing its structure — "a header row, then a column of labeled sections" — the same way a person would build it by hand. See AI agents & MCP for the tool surface this enables.