Skip to content

Recipe: layouts with groups

This recipe builds a Dunder Mifflin contact card: a header row, a body column and a footer row, inside a card that fits its content. The groups place their children themselves, so the card still looks right when a line is added or hidden.

You’ll use rows and columns, Stretch, Gap and Padding, Space between and Hug.

The Dunder Mifflin contact card: header, body and footer laid out with groups

On My Templates, click New Template. Name it Contact card, choose A4 portrait and click Create.

  1. Pick Add group and draw a large group near the top of the page, about 640 × 600. In the layers panel, double-click its row and rename it Card.

  2. In the group bar, set Children layout to Column, click Stretch, and set Gap to 16 and Padding to 24. The card will stack its children top to bottom, each as wide as the card minus its padding.

  3. Give it a light Fill and a Corner radius of 12. A group paints its own background, so the card needs no rectangle behind it.

  1. Draw a group in the top of the card, about 80 high, and rename it Header. The card’s column puts it first, and Stretch gives it the card’s width.

  2. Set Children layout to Row and Children distribution to Space between.

  3. Draw a text box in the header and type Dwight Schrute, in bold, 32. Draw a second one on its right, about 220 × 60, type Assistant to the Regional Manager, and set it in 18, grey, right-aligned. Space between pushes the name against the left edge and the title against the right one.

A row keeps the height you drew, whatever its children. Make it as tall as its tallest text box.

  1. Draw a group in the free space under the header and rename it Body. Set Children layout to Column and Gap to 8.

  2. Draw two text boxes in it: dwight@dundermifflin.com in 24, and Scranton branch in 20, grey.

Draw a group in the free space under the body, about 40 high, and rename it Footer. Set Row and Space between, then draw two text boxes in it: Dunder Mifflin and 570-555-0148, in 20, grey.

Select Body and turn on Hug in the group bar. The body shrinks to its two lines. Then do the same for Card: it now ends 24 points under the footer, its padding.

Hug sizes a column’s height (or a row’s width) to its children, the gaps between them and its padding. From now on, the card follows its content.

Select Scranton branch and press Ctrl+D. The copy joins the body right after it. Change its text to Beet farmer, Schrute Farms. The body grows, the footer moves down, and the card grows with them.

A line hidden by a condition takes no room either, so the card closes up around the others. See Photo, text and a condition to show a shape only when a boolean is true.

Rule Why it matters
Turn on Hug once the group has children An empty hugging group has no room to draw in. To fill it anyway, drop shapes on its row in the layers panel
A new shape goes into the group under the top-left corner you draw from Start drawing inside the group you want to fill
Only the main axis hugs A row keeps the height you drew: make it as tall as its tallest child
Imprime doesn’t measure text A text box is as tall as you drew it: size it for its longest value
Children follow the order of the layers panel To reorder them, drag their rows in the layers panel
Nothing flows to the next page A column taller than its page loses what goes past the edge, with a warning
  • Every layout option, with diagrams: stacks, alignment, distribution, Flex. See Group layouts.
  • Repeat a row once per item of a list: Lists and tables.
  • The Tutorial template every account starts with is built from groups like these. Open it and click through its layers.