Docs / Layout problems

Diagram boxes too close or overlapping: how to fix it

The message means two blocks sit closer than 16 px, the theme's min_gap, or that one covers part of the other.

Updated

{"title": "Bookshop orders",
 "gap": 10,
 "columns": [[{"id": "shop", "title": "Online shop", "tiles": ["Basket", "Checkout"]}],
             [{"id": "orders", "title": "Order service", "tiles": ["Orders", "Stock"]}]],
 "links": [{"from": "shop", "to": "orders"}]}
Bookshop orders

The check: 1 layout problem(s)

'shop' and 'orders' are only 10 px apart (minimum 16)

Why does it happen?

A spacing setting or a position set by hand has put two blocks too close:

  • gap or row_gap set under 16. Left out, columns sit 72 px apart and rows 28 px.
  • x and y in the panels layout, or add() in Python.

Here the cause is "gap": 10. The check measures the space between every pair of blocks and reports each pair under 16 px on its own line. It names each block by its id, or by its title when it has none. When one block covers another, the message reads 'shop' and 'orders' overlap; move one (right_of() and below() keep a gap).

How do I fix it?

Give the two blocks at least 16 px between them.

  1. If you set gap or row_gap, raise it to 16 or more. In Python, both are arguments of columns().
  2. If you placed the blocks with x and y, move one of them.
  3. In Python, place the second block with right_of() or below(), which keep the theme's gap.
  4. Run the check again.

With gap at 40, the check reports 0 layout problems:

{"title": "Bookshop orders",
 "gap": 40,
 "columns": [[{"id": "shop", "title": "Online shop", "tiles": ["Basket", "Checkout"]}],
             [{"id": "orders", "title": "Order service", "tiles": ["Orders", "Stock"]}]],
 "links": [{"from": "shop", "to": "orders"}]}
Bookshop orders

The check: 0 layout problems

See also