Notify
Non-blocking toasts and rich announcements — auto icons, bounded under load, one call on every framework.
Non-blocking toasts and rich announcements — auto icons, bounded under load, one call on every framework.
lib.notify shows a non-blocking toast (quick feedback, bottom-left) or a rich
announcement (persistent, top-right). One call, from the client or the server, on any framework.
lib.notify({ type = 'success', content = 'Action completed' })lib.notify(data) takes a single table:
contentstringrequiredThe text shown. Short for a toast; longer, multi-line text is fine for an announcement.
typestringoptionalAccent color — a semantic name or a direct color (see below). Default default (white).
iconstringoptionalA Lucide icon name in kebab-case (e.g. circle-check). Auto-derived from the semantic type when omitted.
durationnumberoptionalAuto-close delay in ms. Default 5000 (toast) / 10000 (announcement).
idnumber | stringoptionalDedup key. Defaults to type + content — the same toast spammed updates in place instead of stacking, so it never piles up.
A semantic type is recommended — it maps to a color and an auto icon:
type | Color | Icon |
|---|---|---|
success | green | circle-check |
error | rose | circle-x |
warning | amber | triangle-alert |
info | blue | info |
typesuccesscircle-checktypeerrorcircle-xtypewarningtriangle-alerttypeinfoinfoOr pass any direct color from the palette (no auto icon — set icon yourself if you want one):
orange · amber · yellow · lime · green · emerald · teal · cyan · sky · blue · indigo · violet · purple · fuchsia · pink · rose · slate · gray · zinc · neutral · stone · taupe · mauve · mist · olive
Anything unknown falls back to default (white).
Toasts stay tidy under load: at most 5 on screen (oldest fade out) and identical toasts dedup by default. Tune the cap with lib.config.notify.toastCap.
Set variant = 'announcement' for a richer, persistent card (top-right) with a title, longer text, an optional image and a sender.
lib.notify({
variant = 'announcement',
sender = { name = 'Burger Shot', color = '#e11d48' }, -- no logo -> "BS" initials
title = 'Promotion -50%',
content = 'Half-price menus tonight, 8pm to midnight!',
image = 'nui://my_resource/img/promo.png', -- optional
})titlestringoptionalimagestringoptionalsendertableoptional{ name, logo?, color? }. No logo → auto initials; no color → brand azure.
Announcements stack top-right, 3 visible with the rest queued (+N waiting). Press Delete to skip the oldest visible one. Tune the cap with lib.config.notify.announceCap.
Target one player, or broadcast to everyone — same shape, every framework:
-- One player
lib.bridge.notify(source, { type = 'success', content = 'Purchase confirmed' })
-- Everyone
lib.bridge.notifyAll({
variant = 'announcement',
sender = { name = 'Server' },
title = 'Restart in 10 minutes',
content = 'Find a safe spot.',
})The raw event TriggerClientEvent('see_lib:notify', source, data) works too.
-- Business error (auto x icon, rose)
lib.notify({ type = 'error', content = 'Player not found' })
-- Custom icon on a direct color
lib.notify({ type = 'green', icon = 'gift', content = 'Daily reward claimed' })
-- Persistent single toast for this id (updates in place)
lib.notify({ id = 'weather', type = 'info', content = 'Weather: clear' })Nothing is lost under load. Rendering is per-client, so server player count never affects it, and notifications fired before the NUI is mounted (e.g. on restart see_lib) are buffered and flushed on ready.