> For the complete documentation index, see [llms.txt](https://docs.xaman.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xaman.dev/environments/xapps-dapps/xumm-ui-interaction.md).

# Xaman UI interaction

Using the Xaman SDK in xApps, you can trigger native Xaman interaction & receive events from Xaman in your xApp.

xApps are WebApps. They are opened in Xaman for a great user experience. They add value (tooling, wizards) for end users, using Sign Requests to help users perform tasks on the XRPL.

To add value for end users, your xApp will most likely implement some of the features Xaman offers natively in your xApp. E.g. open the QR scanner, Account Destination Picker, or start a Sign Request flow. Then to receive the response from these native Xaman flows in your xApp (WebApp).

**Your xApp can trigger specific actions in Xaman:**

These actions can be sent form your xApp (frontend Javascript) context, and will trigger functionality native to the Xaman app:

* Open a Sign Request
* Open the QR scanner to retrieve a scanned value
* Open the Account Destination Picker
* etc.

{% hint style="info" %}
To prevent showing a double loader (first the Xaman xApp loader, then your xApp's loader while hydrating / booting) you can enable the "**Xaman Loader Screen**" option in the Xaman Developer Console (xApp tab). See [ready()](/js-ts-sdk/sdk-syntax/xumm.xapp/ready.md)
{% endhint %}

**Your xApp can also receive events (data) from Xaman:**

Certain actions in Xaman will trigger an event so your xApp can retrieve data or act based on the event (details below):

* Payload resolved
* QR Code scanner opened/closed
* Destination picker: closed / destination picked

## Example code

```html
<html lang="en">
  <body>
    <div id="destinationname">...</div>
    <input id="destinationaddress" value="" placeholder="Destination address" />
    <button onclick="xumm.xapp.selectDestination()">Pick destination account</button>

    <script src="https://xumm.app/assets/cdn/xumm.min.js"></script>
    <script>
      var xumm = new Xumm('your-api-key')

      xumm.xapp.on('destination', data => {
        if (data.destination.address) {
          document.getElementById('destinationname').innerText = data.destination.name
          document.getElementById('destinationaddress').value = data.destination.address
        } else {
          console.log('No destination selected', data.reason)
        }
      })
    </script>
  </body>
</html>
```

## Trigger actions

{% hint style="info" %}
For all Xaman UI (interface) actions / worfklows you can trigger, see the SDK documentation: [https://github.com/XRPL-Labs/Developer-Help-Center/blob/main/js-ts-sdk/sdk-syntax/xumm.xapp](https://github.com/XRPL-Labs/Developer-Help-Center/blob/main/js-ts-sdk/sdk-syntax/xumm.xapp "mention")
{% endhint %}

## Receive events

{% hint style="info" %}
For all events emitted in your xApp (like the async follow up data of an xApp UI action triggered), see the xApp event handler: [on(xAppEvent, fn)](/js-ts-sdk/sdk-syntax/xumm.xapp/on-event-fn.md)
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.xaman.dev/environments/xapps-dapps/xumm-ui-interaction.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
