# Arrange and place

`arrange:` says how a container lays out its children: the **direction**, the **spot** and the
**spread**, in any order, all optional.

- Direction: `column` (top to bottom, the default) or `row` (left to right).
- Spot: `top`, `bottom`, `left`, `right`, `center`, or a pair like `bottom right`.
- Spread: `spread` puts the free space between the children; `even` puts it around them too.
- `scroll` makes the container scroll when its children don't fit.

Vi works out the rest. You never say which axis is "main"; `bottom right` means the bottom right
corner whichever way the children run.

Picture the container as a box and its children as a small stack. The **spot** says where in the box
the stack sits; the first word is up or down, the second is left or right:

```text
 arrange: center         arrange: top center
┌───────────────┐       ┌───────────────┐
│               │       │     [ A ]     │
│     [ A ]     │       │     [ B ]     │
│     [ B ]     │       │     [ C ]     │
│     [ C ]     │       │               │
│               │       │               │
└───────────────┘       └───────────────┘

 arrange: bottom right   arrange: row, center
┌───────────────┐       ┌───────────────┐
│               │       │               │
│               │       │               │
│          [ A ]│       │ [A]  [B]  [C] │
│          [ B ]│       │               │
│          [ C ]│       │               │
└───────────────┘       └───────────────┘
```

The **spread** shares out the free space instead of grouping the children at one spot: `spread`
puts it only between them, `even` puts it around them too.

```text
 arrange: spread         arrange: even
┌───────────────┐       ┌───────────────┐
│     [ A ]     │       │               │
│               │       │     [ A ]     │
│               │       │               │
│     [ B ]     │       │     [ B ]     │
│               │       │               │
│               │       │     [ C ]     │
│     [ C ]     │       │               │
└───────────────┘       └───────────────┘
```

Try every combination here:

```vi
main home:
  arrange: row, bottom right
  space_inside: 20
  space_between: 8
  color: indigo[50]
  children:
    a:
      size: 20
      color: indigo[300]
    b:
      size: 20
      color: indigo[500]
    c:
      size: 20
      color: indigo[700]
```

`place:` is for one container that should **float** above the others, pinned to a spot of its
parent: `place: bottom right` for a round "+" button, or `place: x, y` to put its middle at a
point out of 100 (`place: 50, 10` is centred, near the top). Games move things this way.

```vi
main home:
  color: white
  children:
    message:
      text: "A list would go here"
      space_inside: 24
    add_button:
      place: bottom right
      space_around: 24
      size: 16
      shape: circle
      color: blue[600]
      button: "+"
      text_style: 28, white
```
