Notifications ​
Toasts appear in the top-right stack, up to Config.MaxToasts; when the stack is full, the oldest is dismissed. The announce variant goes top-centre, one at a time.

Client ​
-- Short form → toast id
local id = exports.np_hud:Notify('Saved', 'Your outfit was saved.', 'success', 3000)
-- Full form
exports.np_hud:Notify({
title = 'Fuel low', message = 'Your **Sultan RS** is at 12%.', type = 'warning',
icon = 'gas-pump', tint = 'orange', duration = 6000, sound = true,
meta = { { icon = 'location-dot', label = 'Alta St' } },
})
-- Same id → updates the toast in place and restarts its timer
exports.np_hud:Notify({ id = id, title = 'Saved', message = 'Updated in place.' })
exports.np_hud:DismissNotify(id)
exports.np_hud:ClearNotify()
From the server, without the export: TriggerClientEvent('np_hud:client:notify', src, data).
Server ​
exports.np_hud:Notify(source, { title = 'Paycheck', message = 'You received **$450**.', type = 'success', icon = 'money-bill' })
exports.np_hud:NotifyAll({ title = 'Weather', message = 'A storm is coming.', icon = 'cloud-bolt' })
exports.np_hud:Announce({ title = 'Server restart', message = 'Restart in **15 minutes**.', tint = 'red' })
Fields ​
| Field | Type | Notes |
|---|---|---|
id |
string ≤ 64 | Generated if missing. Reusing an id updates the toast |
type |
info · success · warning · error |
Default info. Framework names are mapped: primary/inform/police/ambulance → info, warn → warning, danger/fail → error |
variant |
default · compact · announce · staff · call |
|
app |
string ≤ 32 | Small app label |
title |
string ≤ 96 | Either title or message is required |
message |
string ≤ 512 | Supports **bold** only (no HTML). description and text are accepted as aliases |
icon |
Font Awesome name | Without prefix: 'gas-pump' |
tint |
neutral red orange rust pink olive lilac green blue aqua brand |
Icon tile colour |
badge |
0–999 | |
duration |
ms, 0–120000 | Default 5000. 0 = sticky |
progress |
0–100 | Shows a static bar instead of the timer. Sticky unless duration is set; closes 600 ms after reaching 100 |
meta |
{ icon, label }[] (max 4) |
Small info chips |
actions |
{ id, label, key?, style? }[] (max 3) |
style: default · primary · success |
sound |
boolean | Plays a short, quiet blip in the NUI |
All payloads are whitelisted and clamped on the way in, so other resources can't push arbitrary data into the NUI.
Actions ​
Actionable toasts can be answered with a click or a key: Y / N by default (Config.NotifyKeys, rebindable as hudaccept / huddecline). A key press goes to the newest actionable toast.
Client-side actions ​
exports.np_hud:Notify({ variant = 'call', title = 'Incoming call', message = 'Mum', duration = 0,
actions = {
{ id = 'decline', label = 'Decline', key = 'N' },
{ id = 'accept', label = 'Accept', key = 'Y', style = 'success' },
} })
AddEventHandler('np_hud:notifyAction', function(id, action) print(id, action) end)
Server-side actions ​
exports.np_hud:Notify(src, {
variant = 'call', title = 'Tow request', message = 'Accept the job?', duration = 0,
actions = { { id = 'no', label = 'Decline', key = 'N' }, { id = 'yes', label = 'Accept', key = 'Y', style = 'success' } },
}, function(player, action, id)
if action == 'yes' then --[[ ... ]] end
end)
-- or listen globally (server-local event, fired only after validation):
AddEventHandler('np_hud:notifyAction', function(player, id, action) end)
The server validates every action before it fires the callback or event. The toast must exist, the player must be one
of its recipients, the action must be one of the toast's actions, and each player gets one action per toast.
NotifyAll accepts the same optional callback.
DANGER
Never use AddEventHandler('np_hud:server:notifyAction', …) in other resources. It's the raw client net event, and
nothing has validated it yet.
Works with np_passwords
np_passwords uses server-side actions for its Save this code? / Update saved code? toasts (Y / N) and np_hud's interaction prompts for E / G / H at locks. See np_passwords → Bridges.
Framework notifications ​
See Integration → Framework notifications for redirecting
QBCore.Functions.Notify, ESX.ShowNotification and lib.notify to np_hud.