> For the complete documentation index, see [llms.txt](https://mango-5m.gitbook.io/mango5m-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mango-5m.gitbook.io/mango5m-docs/free-resources/mango-notify/developer-guide/framework-integration.md).

# Framework Integration

Route ESX, QBCore, and ox\_lib notifications through Mango Notify.

Mango Notify doesn't need a framework — but your framework's built-in notifications can be routed through it, so **every** script on the server shares one look, even ones that have never heard of Mango Notify.

{% tabs %}
{% tab title="ESX Legacy" %}
Add this to any client script that loads **after** `es_extended` (or a tiny resource of its own):

```lua
RegisterNetEvent('esx:showNotification', function(msg, type_, duration)
    exports.mango_notify:Notify({
        type        = (type_ == 'error' and 'error')
                   or (type_ == 'success' and 'success')
                   or 'info',
        description = msg,
        duration    = duration,
    })
end)
```

Every `ESX.ShowNotification(...)` and `esx:showNotification` event on the server now renders through Mango Notify.
{% endtab %}

{% tab title="QBCore" %}
Replace the body of `QBCore.Functions.Notify` in `qb-core/client/functions.lua`:

```lua
function QBCore.Functions.Notify(text, textype, length)
    local msg = type(text) == 'table' and (text.text or text.caption) or text
    exports.mango_notify:Notify({
        type        = textype or 'info',
        description = msg,
        duration    = length,
    })
end
```

{% endtab %}

{% tab title="ox\_lib" %}
{% hint style="info" %}
**ox\_lib is not a dependency.** Mango Notify never calls it and runs identically on a server that doesn't have it. This tab is only for people who already run ox\_lib. If you don't, set `Config.OxLibCompat = false` and the translation exports are never registered.
{% endhint %}

Every ox\_lib notification path — `lib.notify(data)` on the client, `lib.notify(playerId, data)` from the server, the `ox_lib:notify` event and `lib.defaultNotify` — funnels into a single function. Redirect that one function and **every resource on your server that uses ox\_lib notifications** renders through Mango Notify, without touching any of them.

In `ox_lib/resource/interface/client/notify.lua`, inside `lib.notify`, replace:

```lua
    SendNUIMessage({
        action = 'notify',
        data = payload
    })
```

with:

```lua
    exports.mango_notify:OxNotify(payload)
```

That is the whole edit — Mango Notify translates ox\_lib's props for you:

| ox\_lib                                                      | becomes                                                                              |
| ------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
| `type` (`inform` / `info` / `success` / `error` / `warning`) | the matching Mango type                                                              |
| `position` `top` / `bottom`                                  | `top-center` / `bottom-center`; the corners map 1:1                                  |
| `icon` (`'user'` or `{ 'fas', 'user' }`)                     | `fa-solid fa-user` — full classes, inline SVG and image paths pass through untouched |
| `showDuration`                                               | `progress`                                                                           |
| `iconColor`                                                  | `accent` (Mango tints the accent line, not the icon)                                 |
| `style.backgroundColor` / `.color` / `.borderColor`          | `background` / `titleColor` / `border`                                               |
| `sound = { bank, set, name }`                                | left to ox\_lib to play — Mango stays silent so the call doesn't fire two sounds     |

Props with no Mango equivalent (`iconAnimation`, `alignIcon`, nested CSS selectors in `style`) are ignored rather than erroring, and anything omitted falls back to your `config.lua` defaults.

{% hint style="info" %}
It's one line in one file, so re-applying it after an ox\_lib update takes seconds. Prefer not to touch ox\_lib at all? Call `exports.mango_notify:Notify(...)` directly in your own resources — ox\_lib's export can't be overridden from outside the resource.
{% endhint %}

Need the mapping without showing anything? `exports.mango_notify:FromOxLib(data)` returns the translated table so you can patch it first.
{% endtab %}
{% endtabs %}

## Migrating from another notify resource

Because everything is exports and events, migration is usually a search-and-replace in your other resources:

| Coming from    | Replace                                                 | With                                                                                               |
| -------------- | ------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| ox\_lib        | `lib.notify({ type = t, description = d })`             | *nothing* — apply the one-line edit above and every existing call keeps working                    |
| okokNotify     | `exports['okokNotify']:Alert(title, text, time, type)`  | `exports.mango_notify:Notify({ title = title, description = text, duration = time, type = type })` |
| mythic\_notify | `exports['mythic_notify']:DoHudText(type, text)`        | `exports.mango_notify:Notify({ type = type, description = text })`                                 |
| t-notify       | `exports['t-notify']:Alert({ style = s, message = m })` | `exports.mango_notify:Notify({ type = s, description = m })`                                       |

Type names line up for the common cases (`success` / `error` / `info` / `warning`); anything unrecognised falls back to the default style rather than erroring.

{% hint style="info" %}
Keep a thin wrapper function in shared code if you integrate many scripts — one place to adjust mappings beats editing every call site twice.
{% endhint %}
