> For the complete documentation index, see [llms.txt](https://docs.amply.tools/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.amply.tools/mini-apps/building-a-mini-app.md).

# Building a mini-app

Create a mini-app, lay out its screens, and wire its buttons and gestures in the Builder editor.

How to create a mini-app in the Builder, find your way around the editor, and set up screens, components, actions and colours. For what a mini-app is and how it reaches users, start with the [Builder overview](https://docs.amply.tools/mini-apps/overview.md).

## Create one

Open **Builder** in the project sidebar. The list shows every mini-app in the project, with its type and when it was last changed. The ⋮ menu on a row opens, renames, duplicates or deletes it.

![The Builder list: five mini-apps of different types](https://1054862905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVDwzd9ZLJgvvnIADl8D%2Fuploads%2Fgit-blob-94069f0a378391e9116824549d5e68b6a7e2c296%2Fbuilder-list.png?alt=media)

Click **New document**, give it a **Name**, and pick a **Type**. The type only groups mini-apps in the list and decides which starters you get under **Start from**; it doesn't limit what you can build.

| Type           | Starters                                                                       |
| -------------- | ------------------------------------------------------------------------------ |
| **Onboarding** | A four-screen full-screen flow                                                 |
| **What's new** | A full screen, or a what's-new sheet                                           |
| **Survey**     | A four-screen full-screen survey, or a one-question sheet                      |
| **Custom**     | An offer sheet that opens a plan screen, a rating card, or a three-slide story |

Every type also offers **Blank**, a single empty screen. A starter is only a beginning: every screen and element in it can be changed or removed.

<figure><img src="https://1054862905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVDwzd9ZLJgvvnIADl8D%2Fuploads%2Fgit-blob-32ef9502fe4dac0b8011a948b8ac14718d3cbd8f%2Fbuilder-new-document.png?alt=media" alt="The New document dialog: name, type Custom, and the starters Offer sheet, Rating card, Story and Blank" width="440"><figcaption></figcaption></figure>

## The editor

![The editor: the tree and components on the left, every screen on the canvas, the screen's settings on the right](https://1054862905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVDwzd9ZLJgvvnIADl8D%2Fuploads%2Fgit-blob-04c5e237af73fdcc7f5785d8b3b6a7d00017d05f%2Fbuilder-editor.png?alt=media)

* **Tree** (top left) — every screen and, inside it, every element. The first screen is marked **Start**: the mini-app opens on it. Use **+** to add a screen; the ⋮ menu on a screen duplicates, moves or deletes it.
* **Components** (bottom left) — the elements you can add. Click one to add it to the selected screen or container, or drag it onto a screen. The **Top bar** and **Tab bar** tiles are not shown on devices yet.
* **Canvas** (centre) — all screens side by side, drawn at phone size. Click an element to select it; press and hold to drag it to another place.
* **Inspector** (right) — the settings of whatever is selected. With nothing selected it shows the mini-app's own settings: colours, fonts, languages and the transition between screens.
* **Header** — undo and redo, **Localization**, **History**, the save status and **Publish**. Changes save on their own a couple of seconds after you stop editing.
* **Toolbar** (bottom of the canvas) — **Preview**, the preview theme (light or dark), the preview language, the device frame (several iPhones and a Pixel) and zoom.

Keyboard shortcuts work when no field has focus: ⌘Z / Ctrl+Z to undo, ⇧⌘Z / Ctrl+Y to redo, ⌘C, ⌘X and ⌘V to copy, cut and paste elements, and Delete to remove the selected element. With a screen selected, Delete removes the whole screen.

## Screens

Select a screen in the tree to see its settings. **Presentation** sets the kind of screen and how it behaves:

* **Sheet** — **Height** (**Fit content**, or a custom height as a share of the screen), **Corner radius**, **Enter** animation (**Slide**, **Spring** or **Fade**), **Drag handle**, **Close button** (a ✕ in the top corner), and **Backdrop** (**Dim** with an opacity, or **None**).
* **Card** — corner radius, enter animation (**Scale** or **Fade**), close button and backdrop. A card is always as tall as its content.
* **Story** — **Duration** of the slide in seconds, **Close button**, **Bars** (light or dark progress bars), and **After last slide**: **Close** the story or **Stay** on the last slide. Story screens placed next to each other play as one story.
* **Full screen** — no extra options. To keep buttons at the bottom while the content above them scrolls, put the content in a **Scroll** and the buttons after it.

**Background** fills the screen with a colour, a gradient or an image.

**Interactions** bind gestures to actions: **Swipe down**, **Swipe up**, **Swipe left**, **Swipe right**, and **Tap outside** on sheets and cards. Each kind has defaults, shown in the list as **Close · default**: swiping down closes a story, or a sheet that has a drag handle, and tapping outside closes a sheet or card. In a story, gestures are set on its first slide and apply to every slide.

![A story in the editor: three slides on the canvas, and the story's duration, bars and gestures on the right](https://1054862905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVDwzd9ZLJgvvnIADl8D%2Fuploads%2Fgit-blob-d2e2f92b6545a8356262c1a244494342aaaf8e93%2Fbuilder-story.png?alt=media)

## Components

| Component               | What it is for                                                                                                                       |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| **Text**                | Headings and body copy. Pick a text style (from Huge Title to Footnote), colour and alignment.                                       |
| **Image**               | Pictures and illustrations: PNG, JPEG, GIF or WebP. Each image can be up to 4 MB, and all images of a mini-app together up to 10 MB. |
| **Button**              | A tappable label, with an optional icon. Runs its actions on tap.                                                                    |
| **Column**, **Row**     | Stack elements vertically or side by side, with spacing and alignment.                                                               |
| **Overlay**             | Layer elements on top of each other, for example a title over a picture.                                                             |
| **Scroll**              | Lets its content scroll.                                                                                                             |
| **Spacer**, **Divider** | Space and thin lines between elements.                                                                                               |
| **Text Input**          | A field the user types into: general text, email, password, number or phone; one line or several.                                    |
| **Choice**              | A list of options the user picks one of.                                                                                             |
| **Toggle**              | An on/off switch.                                                                                                                    |
| **Slider**              | A value picked on a scale between a minimum and a maximum.                                                                           |

Every component also has **View** settings (fill, gradient, image, corner radius, border) and **Layout** settings (margins, padding, width, height, alignment and visibility). The **Style actions** menu copies the look of one element and pastes it onto another.

## Actions

Select a button and open **Actions** in the inspector. **On tap** holds the list of actions the button runs, in order:

| Action             | What it does                                                                                                                                                                                                                         |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Navigate**       | Goes to another screen of the mini-app, with a transition (**None**, **Fade**, **Slide**, **Slide up**).                                                                                                                             |
| **Navigate back**  | Returns to the previous screen.                                                                                                                                                                                                      |
| **Close flow**     | Closes the mini-app.                                                                                                                                                                                                                 |
| **Open deep link** | Opens a link your app handles, for example `myapp://paywall`. The **{@}** button inserts values such as the campaign name or a custom property; see [Managing deeplinks](https://docs.amply.tools/user-guide/managing-deeplinks.md). |
| **Request review** | Shows the store's native rating prompt.                                                                                                                                                                                              |
| **Save answers**   | Saves the answers on this screen to the user's custom properties.                                                                                                                                                                    |
| **Track event**    | Sends an event with a name and optional parameters, for your goals and analytics.                                                                                                                                                    |

Put **Save answers** and **Track event** before **Navigate** or **Close flow**: an action after one of those never runs, and the editor marks it. Name events in `PascalCase`, for example `OfferPlansOpened`, and parameter keys in `snake_case`.

A screen can also run actions the moment it opens, under **On screen visit actions**.

<figure><img src="https://1054862905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVDwzd9ZLJgvvnIADl8D%2Fuploads%2Fgit-blob-0403c59db68682ed70c51f34b6be3932bb0ac7f2%2Fbuilder-button-actions.png?alt=media" alt="A selected button&#x27;s settings: text, font, icon, and two actions on tap — Track event, then Navigate" width="320"><figcaption></figcaption></figure>

Closing with a button, with an action that runs when a screen opens, or by a story ending after its last slide counts as the user finishing the mini-app. Closing with the ✕, a gesture, a tap outside or the Android back button counts as dismissing it. See [Campaign actions](https://docs.amply.tools/concepts/campaign-actions.md#mini-app) for how campaigns and [goals](https://docs.amply.tools/user-guide/campaign-goals.md) use the difference.

## Answers

**Text Input**, **Choice**, **Toggle** and **Slider** each have a **Property key**: the name the answer is saved under, in `snake_case`, unique in the mini-app. When a button runs **Save answers**, the answers on that screen are saved to the user as custom properties under those keys. An empty field or a choice nobody picked is skipped.

Saved answers work like any other custom property: target a later campaign on them, or read them in your app. See [User attributes](https://docs.amply.tools/concepts/user-attributes.md).

![A survey sheet with a slider, a choice and a text field, and an onboarding question with a choice and a toggle](https://1054862905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVDwzd9ZLJgvvnIADl8D%2Fuploads%2Fgit-blob-f6bdb53703e29ea92ff06d10f656b8ae068ae475%2Fbuilder-inputs.png?alt=media)

## Colours, fonts and dark mode

With nothing selected, the inspector shows the mini-app's **Colors**: Primary, Secondary, Tertiary and Neutral, each with a light and a dark value. You pick the light value; the Builder generates the dark one from it. Every element that uses a theme colour follows these, so changing **Primary** recolours every button at once.

On the device, a mini-app follows the phone's light or dark mode. Use **Preview theme** in the toolbar to check both.

![The same offer sheet in light and in dark mode](https://1054862905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVDwzd9ZLJgvvnIADl8D%2Fuploads%2Fgit-blob-df3116378f90082879912ca4acf4d55bfff578ba%2Fbuilder-dark-mode.png?alt=media)

Text uses the platform's system font: San Francisco on iOS, Roboto on Android.

## Preview

**Preview** in the toolbar turns the canvas into a working phone: one screen at a time, buttons and gestures work, stories play. Actions that would leave the mini-app show a note instead, for example what **Save answers** would save. Combine it with the theme, language and device switches to check every variant before you publish.

To see the mini-app inside your real app, publish it, attach it to a campaign and use **Test on device** on the campaign page. See [Testing and rollout](https://docs.amply.tools/user-guide/testing-and-rollout.md).

## Related

* [Languages](https://docs.amply.tools/mini-apps/languages.md) — add translations and check what's missing
* [Publishing and versions](https://docs.amply.tools/mini-apps/publishing-and-versions.md) — publish, roll back, attach to a campaign
* [Building with an AI assistant](https://docs.amply.tools/mini-apps/building-with-ai.md) — let your assistant draft it, then edit here
