Channel: send messages

Element layout

The six-column grid: widths, heights, minimum sizes and what the app adjusts by itself.

Open as Markdown

Elements in a message sit in a grid. Two fields decide how big an element is: width and height. The app does the rest.

The grid

The area below a message's text is divided into 6 columns. width says how many of them an element takes up:

widthWidth
6 (default)the full width
3half
2a third

Elements fill the rows from left to right, in the order of your list. If the next one no longer fits in the row, a new row starts.

shop-api maintenance

Today at 10 pm, about 10 minutes.

Maintenance

Deploys

Restart

The three buttons have width 2. The toggles have width 3, but don't fit side by side in the narrow bubble. So the app stacks them.

The matching list, in the elements field of POST /v1/push:

JSON
[
  {"type": "toggle", "id": "wartung",  "label": "Maintenance", "value": true, "width": 3},
  {"type": "toggle", "id": "deploys",  "label": "Deploys", "width": 3},
  {"type": "text",   "id": "neustart", "text": "Restart", "style": "caption"},
  {"type": "button", "id": "api",      "label": "API",  "width": 2, "height": 56},
  {"type": "button", "id": "shop",     "label": "Shop", "width": 2, "height": 56},
  {"type": "button", "id": "db",       "label": "DB",   "style": "secondary", "width": 2, "height": 56}
]

Height

Without height, an element is as tall as its content needs. With height, you set a minimum height in points. If the content needs more, the element gets taller.

What height is good for:

  • A button becomes a big tile, for example "height": 56.
  • A chart gets taller bars, for example "height": 220.

A text has no height. It's always as tall as its content.

Minimum sizes

To keep everything readable and easy to tap, every element has limits:

ElementMinimum widthHeight
text2 columnsby content
button2 columns44 to 240
toggle3 columns64 to 240
input3 columns160 to 400
chart3 columns120 to 480
table3 columns80 to 800

If you give less or more, Packlets doesn't reject it but moves the value to the limit. What was changed is in the response of POST /v1/push, in the warnings field (in English, or in German with the header Accept-Language: de):

JSON
{
  "message_id": "5b0c1a52-7c1e-4a43-9d0b-2f6f0c7d1e11",
  "warnings": ["wartung: width 2 → 3 (minimum width for toggle)", "db: height 30 → 44 (minimum height for button)"]
}

Only a width outside 1 to 6 is an error (400).

What the app adjusts on its own

Phones come in different widths, and a message is narrower than the screen. So the app adapts your layout to keep it tidy:

  • Content gets room. If a label doesn't fit in the given width, the app makes the element wider. If it then no longer fits in the row, it moves to the next one.
  • Rows are always full. If space is left in a row, its elements get wider. A single element with width: 3 therefore spans the full width.
  • Equal height. Cards and buttons in a row are the same height. Text stays at the top left.
  • Charts show only every second or third label when there are many points.

So your width is a wish, not a command. Two elements with width: 3 and long labels often end up stacked in a message. Plan roughly and check the result on your phone.

Tips

  • Start without width. Everything stacked always looks tidy.
  • Keep labels short, then two elements fit side by side.
  • Three buttons with short labels, width: 2 and height: 56 make a row of tiles.
  • A text with style: "caption" above a group works like a subheading.
  • Ready-made examples to borrow from are in Templates.