# Page builder

> Build pages from blocks bound to your data, preview them, and save them as a change.

Source: https://docs.ligament.ai/guides/building-apps/page-builder/

The page builder makes pages such as dashboards, desk overviews and team homes from blocks: metrics, charts, lists of records, text, callouts, buttons and images. Each data block reads records live, as the person looking at the page, so everyone sees only what their access allows. A page is an artefact in the [spec store](https://docs.ligament.ai/guides/building-apps/index.md), so it is planned, versioned and reviewable like any other change.

To start a page, open **Build › Pages** and select **New page**. To change an existing one, open it in Build › Pages and select **Edit**. Anyone with access to Build can edit pages and save the result as a changeset; applying needs the `build:pages` permission.

\[Screenshot: The page builder with the Loans desk page: the outline and block library on the left, four blocks on the canvas, and the Data tab of the selected list block on the right\]

## Find your way around

-   The header holds **Preview**, **Plan**, **Save as changeset** and **Apply**, and badges for the page’s state: **New page**, **Live · v3**, **Draft · 1 change**, or **Customised · shipped by office\_moves 1.0.0** for an app’s page you’ve changed.
-   The **Design** tab is the visual editor. **JSON** shows the same page as a document, and **History** lists every applied version.
-   On the left, the **Outline** lists the page and its blocks in order (select one to edit it, move it up or down, duplicate or delete it), and the **Library** below lists the blocks you can add.
-   The canvas lays blocks out on a 12-column grid. The **−** and **+** on a block make it narrower or wider.
-   On the right, the properties panel edits the page, or the selected block.

Undo and redo are the arrows at the right of the tab bar.

## Page settings

Select **Page** at the top of the outline:

| Setting | What it does |
| --- | --- |
| Key | The page’s permanent identifier, in lower\_snake\_case. You can’t change it after the first apply. |
| Title, Description | Shown at the top of the page. |
| App | The app the page belongs to: it shows in that app’s section of the navigation. The list has the apps installed in this workspace and the apps you’re building in **Build › Apps** (their pages show in the navigation before the app is published). **No app (URL only)** makes it a workspace page. |
| Shown to | The roles that can open the page. None ticked means everyone in the workspace; owners and admins always see it. |
| Show in the app’s navigation, Nav label | Adds the page to its app’s section in the navigation. |
| Density | Compact or comfortable spacing. |

## Blocks

| Block | Shows |
| --- | --- |
| Metric | One number: a count of records, or the sum or average of a numeric field |
| Chart | Records grouped by a field (dates by day, week or month), as bars, lines, a pie or a table |
| List | A table of records with the columns, filters, sort and number of rows you choose |
| Rich text | Markdown. `{{viewer.name}}`, `{{viewer.role}}` and `{{today}}` are filled in for the viewer. |
| Heading, Callout, Button, Image, Divider | Page structure and links |

The library also lists approved custom components, and blocks that aren’t available yet together with what to use instead today.

Each block has four tabs:

-   **Content**: its title, width (out of 12 columns) and the block’s own settings, such as a heading’s text.
-   **Data** (metric, chart and list): the **Entity** it reads; the measure or the columns (up to 8); **Filters**, where every condition must match and values can use `@me` and relative dates such as `@today-14d`; and for lists the sort and the number of rows (1 to 50). A note at the bottom lists the fields the block reads.
-   **Visibility**: roles that see this block. None ticked means everyone who can see the page.
-   **JSON**: the block as a document, for settings the form doesn’t cover.

## Preview

Switch the canvas from **Layout** to **Preview** to see the page with live data while you edit. Pick a width (1440, 1024 or 390 px) and whose view to show: **As you**, or as any role in the workspace.

**Preview** in the header opens the draft in its own browser tab, at full size, without saving anything.

## Save your work

Nothing you do in the builder is live until you apply it.

-   **Plan** shows what applying would change, for example `Create __tenant__/page/loans_desk` with `+ add heading`, `+ add metric`, and whether you hold `build:pages`.
-   **Apply** puts the page live. Each apply is a new version on the **History** tab.
-   **Save as changeset** saves the draft for review instead. The builder stays on that changeset (**Save to changeset**, **Apply changeset**) until it’s applied. See [Changesets](https://docs.ligament.ai/guides/building-apps/changesets/index.md).

\[Screenshot: The Plan dialog for a new page: Create tenant/page/loans\_desk, with the four blocks it adds and the Close, Save as changeset and Apply buttons\]

If someone else changed the page while you were editing, **Apply** shows either **Merged with newer changes** (your edits and theirs touch different parts: review and **Apply merged**) or **Conflicting changes** (you both changed the same value: choose a value for each, then plan again). Nothing is overwritten without you seeing it. See [Base hashes and merges](https://docs.ligament.ai/guides/building-apps/index.md#base-hashes-and-merges).

If your role doesn’t hold `build:pages`, the plan says so and offers **Save as changeset**, so someone who holds it can apply your page.

## The JSON tab

The **JSON** tab shows exactly the document that `GET /api/spec/page/<key>` returns, so what you see here is what an agent or the [CLI](https://docs.ligament.ai/reference/cli/index.md#spec-pull) reads and applies. You can edit it directly: the tab validates as you type, marks it **Valid** or lists each problem with its path, and your edits show up in the Design tab.

\[Screenshot: The JSON tab of the Loans desk page, showing the page document with its heading, metric and list blocks, marked Valid\]

## Custom components

A custom component is a block a developer writes and uploads; it runs in a sandbox and can only read the data it was approved for. A new component version waits until someone with the **Approve custom components** permission approves it in **Build › Components**. Owners have it, and can grant it to other roles in **Settings › Access › Roles**.

In the library, **Custom components** lists each component’s latest approved version. A component with a new version waiting shows “v1.1.0 needs approval”; one with no approved version shows “Needs approval (Build → Components)” and can’t be added yet. On a custom block’s **Data** tab, each dataset shows whether the component is approved to read the entity you pick.

## Pages that apps ship

Pages that come with an installed app open in the same builder. Your changes are stored as your customisation of the app’s page, and an upgrade of the app keeps them. If the app’s author made the app additive-only or locked, the plan tells you what you can’t change. See [Upgrades and your customisations](https://docs.ligament.ai/guides/building-apps/upgrades/index.md).
