> For the complete documentation index, see [llms.txt](https://docs.digitalsamba.com/reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalsamba.com/reference/sdk/methods/adduicallback.md).

# addUICallback()

Overrides a UI (frontend) interaction using a callback function. The default action of the Samba's frontend will not execute, and instead your callback will override it.

{% hint style="info" %}
For now only **leaveSession** UI callback is supported.
{% endhint %}

In the below example user will be asked by a confirmation popup before leaving the session:

<pre class="language-javascript"><code class="lang-javascript"><strong>const leaveSessionCallback = () => {
</strong><strong>   console.log('Custom leave session logic called');
</strong><strong>   if (confirm('Are you sure you want to leave the session?')) {
</strong>      sambaFrame.leaveSession();
   }
<strong>};
</strong><strong>
</strong><strong>sambaFrame.addUICallback('leaveSession', leaveSessionCallback);
</strong></code></pre>

{% hint style="info" %}
This method is often used in conjunction with the [removeUICallback](/reference/sdk/methods/removeuicallback.md) method.
{% endhint %}
