# Embedded App

## Overview

An embedded app provides a seamless way to integrate one UI Bakery app within another. This feature enables the reuse of extensive logic blocks across multiple applications.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FXrHfVtXLqi0t4FYTybPh%2FCleanShot%202025-07-28%20at%2016.12.47%402x-min.png?alt=media&#x26;token=211b6244-15da-402b-81f4-5bf456915790" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
Embedded apps are perfect for handling complex logic, but they can slow down page loading. We recommend avoiding them unless multipage functionality is necessary. If not, then it's better to use [modules](https://docs.uibakery.io/concepts/modules) instead.
{% endhint %}

### Properties

<table><thead><tr><th width="124.16015625">Name</th><th width="119.8984375">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code></td><td><code>string</code></td><td>Component name</td></tr><tr><td><code>value</code></td><td>–</td><td>Last emitted event from the app</td></tr></tbody></table>

### Methods

<table><thead><tr><th width="124.671875">Name</th><th width="128.4453125">Parameters</th><th width="119.375">Returns</th><th>Description</th></tr></thead><tbody><tr><td><code>setData</code></td><td><code>data: any</code></td><td><code>void</code></td><td>Set app data</td></tr><tr><td><code>reload</code></td><td>–</td><td><code>void</code></td><td>Reload the app iframe</td></tr></tbody></table>

### Triggers

<table><thead><tr><th width="184.65625">Name</th><th>Description</th></tr></thead><tbody><tr><td><strong>On Load</strong></td><td>Triggered when the app loads</td></tr><tr><td><strong>On Event</strong></td><td>Triggered when the app fires an event</td></tr></tbody></table>

## Working with the component

In this section, we'll review two ways of communicating with an embedded app - sending data from the parent app to the embedded app and vice versa.

### Sending data from a parent app to an embedded app

You can send the data to an embedded app by calling the `{{ui.app.setData({userId:1})}}` method. Alternatively, you can also set the embedded app data in its **Data** field.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FMyw3HfZhuIgui3AxJ3wd%2FCleanShot%202025-04-22%20at%2013.16.38%402x-min.png?alt=media&#x26;token=7f8cddf8-d30d-4f3b-af40-30db4e833de0" alt=""><figcaption></figcaption></figure>

Then, in the embedded app, you can also subscribe to the **On App Data** trigger with the last received value accessible in the `{{app.data}}` variable.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FOIaYjwb9PzxwJjfBhNjC%2FCleanShot%202025-05-07%20at%2014.15.14%402x-min.png?alt=media&#x26;token=9e4b0117-8c05-4d6d-90da-be2f7f019b30" alt=""><figcaption></figcaption></figure>

### Sending data from an embedded app to a parent app

To send the data from an embedded app to a parent app, you can call the `{{app.triggerEvent({data:'data from embedded app'})}}` method from any embedded app's code step.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FzlpWLnNttYA9ypyXVFuz%2FCleanShot%202025-05-07%20at%2014.20.04%402x-min.png?alt=media&#x26;token=5d32d26f-ae3b-4139-8f96-830e85a33593" alt=""><figcaption></figcaption></figure>

Then, in the parent app, you can subscribe to the embedded app's **On Event** trigger, with the last received value accessible in the `{{ui.app.value}}` variable.

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FI3L72fszrYm2yjFFGrS0%2FCleanShot%202025-05-07%20at%2014.24.37%402x-min.png?alt=media&#x26;token=c42e692d-2cb3-466d-9c56-681a72a4e979" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.uibakery.io/reference/working-with-components/embedded-app.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
