> ## Documentation Index
> Fetch the complete documentation index at: https://docs.autype.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Layout

> Section types, columns, page breaks, and spacers

Sections are the top-level content containers of your document. Every document has a `sections` array containing one or more sections. Each section holds a `content` array of elements.

## Flow section

The most common section type. Content flows across pages automatically.

```json theme={null}
{
  "type": "flow",
  "newPage": true,
  "columns": { "count": 2, "space": 1.27, "separate": true },
  "content": [
    { "type": "h1", "text": "Chapter 1" },
    { "type": "text", "text": "Content flows across pages automatically." }
  ]
}
```

### Properties

| Property  | Type    | Required | Default | Description                                                                                            |
| --------- | ------- | -------- | ------- | ------------------------------------------------------------------------------------------------------ |
| `type`    | string  | **Yes**  | —       | Must be `"flow"`                                                                                       |
| `id`      | string  | No       | —       | Optional unique identifier. Max: 100 chars.                                                            |
| `newPage` | boolean | No       | `true`  | Start this section on a new page. Set to `false` to continue on the same page as the previous section. |
| `columns` | object  | No       | —       | Multi-column layout. See [Columns](#columns).                                                          |
| `content` | array   | **Yes**  | —       | Array of content elements. Max: 5000 elements.                                                         |

### Columns

Enable multi-column layout for a flow section.

```json theme={null}
{
  "type": "flow",
  "columns": { "count": 2, "space": 1.5, "separate": true },
  "content": [ ... ]
}
```

| Property   | Type    | Required | Default | Description                                     |
| ---------- | ------- | -------- | ------- | ----------------------------------------------- |
| `count`    | number  | **Yes**  | —       | Number of columns (1–4).                        |
| `space`    | number  | No       | `1.27`  | Space between columns in cm (0–5).              |
| `separate` | boolean | No       | `false` | Show a vertical separator line between columns. |

## Page section

A single positioned page — useful for cover pages, title pages, or any content that needs precise vertical positioning. Content does **not** flow to the next page.

```json theme={null}
{
  "type": "page",
  "align": "center",
  "content": [
    { "type": "h1", "text": "My Document", "align": "center" },
    { "type": "text", "text": "A subtitle", "align": "center" }
  ]
}
```

### Properties

| Property  | Type   | Required | Default | Description                                           |
| --------- | ------ | -------- | ------- | ----------------------------------------------------- |
| `type`    | string | **Yes**  | —       | Must be `"page"`                                      |
| `id`      | string | No       | —       | Optional unique identifier. Max: 100 chars.           |
| `align`   | string | No       | `"top"` | Vertical alignment: `"top"`, `"center"`, `"bottom"`   |
| `startY`  | number | No       | —       | Y position in cm from top (0–100). Overrides `align`. |
| `content` | array  | **Yes**  | —       | Array of content elements. Max: 200 elements.         |

<Warning>
  Page sections are limited to a single page. If the content exceeds the page height, it will be clipped. Use flow sections for content that should span multiple pages.
</Warning>

## Page break

Forces a page break at the current position. Optionally changes the page orientation for subsequent pages.

```json theme={null}
{ "type": "pageBreak" }
```

With orientation change:

```json theme={null}
{ "type": "pageBreak", "orientation": "landscape" }
```

### Properties

| Property      | Type   | Required | Default | Description                                                                                                          |
| ------------- | ------ | -------- | ------- | -------------------------------------------------------------------------------------------------------------------- |
| `type`        | string | **Yes**  | —       | Must be `"pageBreak"`                                                                                                |
| `id`          | string | No       | —       | Optional unique identifier. Max: 100 chars.                                                                          |
| `orientation` | string | No       | —       | Change page orientation after the break: `"portrait"` or `"landscape"`. If omitted, the current orientation is kept. |

## Spacer

Adds vertical whitespace between elements.

```json theme={null}
{ "type": "spacer", "height": 2 }
```

The `height` can be specified as a number (line units) or a pixel string:

```json theme={null}
{ "type": "spacer", "height": "40px" }
```

### Properties

| Property | Type             | Required | Default | Description                                                                 |
| -------- | ---------------- | -------- | ------- | --------------------------------------------------------------------------- |
| `type`   | string           | **Yes**  | —       | Must be `"spacer"`                                                          |
| `id`     | string           | No       | —       | Optional unique identifier. Max: 100 chars.                                 |
| `height` | number \| string | No       | `1`     | Height as line count (0.5–50) or pixel string (e.g., `"20px"`, `"50.5px"`). |

## Complete example

```json theme={null}
{
  "document": { "type": "pdf", "size": "A4" },
  "sections": [
    {
      "type": "page",
      "align": "center",
      "content": [
        { "type": "h1", "text": "Annual Report 2025", "align": "center" },
        { "type": "spacer", "height": 2 },
        { "type": "text", "text": "Acme Corporation", "align": "center", "fontSize": 18 }
      ]
    },
    {
      "type": "flow",
      "content": [
        { "type": "toc", "title": "Table of Contents" },
        { "type": "pageBreak" }
      ]
    },
    {
      "type": "flow",
      "content": [
        { "type": "h1", "text": "Executive Summary" },
        { "type": "text", "text": "This section provides an overview of the year." }
      ]
    },
    {
      "type": "flow",
      "columns": { "count": 2, "space": 1.5 },
      "content": [
        { "type": "h1", "text": "Financial Data" },
        { "type": "text", "text": "Left column content..." },
        { "type": "text", "text": "Right column content..." }
      ]
    },
    {
      "type": "flow",
      "content": [
        { "type": "pageBreak", "orientation": "landscape" },
        { "type": "h1", "text": "Appendix: Wide Tables" },
        { "type": "text", "text": "This section uses landscape orientation for wide tables." }
      ]
    }
  ]
}
```
