Notifications
Display styled notifications with icons, sounds, and animations.
Client Exports
notify
Send a custom notification with full control over appearance.
exports['trinity-ui']:notify(data)Parameters:
| Property | Type | Default | Description |
|---|---|---|---|
title | string | β | Notification title |
description | string | β | Message text (alias: message) |
id | string | number | auto | Unique ID β reuses existing notification if matched |
duration | number | 5000 | Auto-hide duration in milliseconds |
position | string | Config value | Screen position (see below) |
type | string | β | 'info' | 'warning' | 'success' | 'error' |
icon | string | β | Iconify icon name (e.g. 'fa6-solid:check') |
iconAnimation | string | β | 'spin' | 'spinPulse' | 'pulse' | 'beat' | 'fade' | 'beatFade' | 'bounce' | 'shake' |
iconColor | string | β | Icon color (hex) |
alignIcon | string | β | 'top' | 'center' |
style | table | β | Custom CSS styles |
sound | table | β | Sound to play (see below) |
Positions: 'top' 'top-right' 'top-left' 'bottom' 'bottom-right' 'bottom-left' 'center-right' 'center-left'
Sound Table:
sound = {
bank = 'DLC_HEIST_HACKING_SNAKE_SOUNDS', -- Audio bank name
set = 'HUD_MINI_GAME_SOUNDSET', -- Sound set
name = 'PICK_UP' -- Sound name
}Example:
exports['trinity-ui']:notify({
title = 'Success',
description = 'Item purchased successfully!',
type = 'success',
icon = 'fa6-solid:check',
duration = 5000,
position = 'top-right'
})You can also pass a simple string:
exports['trinity-ui']:notify('Hello world!')defaultNotify
Send a notification using a predefined type style.
exports['trinity-ui']:defaultNotify(data)Parameters:
| Property | Type | Default | Description |
|---|---|---|---|
title | string | β | Notification title |
description | string | β | Message text |
type | string | 'info' | 'info' | 'warning' | 'success' | 'error' |
Example:
exports['trinity-ui']:defaultNotify({
title = 'Warning',
description = 'You are running low on fuel.',
type = 'warning'
})Server-Side Usage
trinity.notify
Send a notification to a specific player from the server.
trinity.notify(source, data)Example:
trinity.notify(source, {
title = 'Welcome',
description = 'Welcome to the server!',
type = 'info'
})trinity.notifyAll
Broadcast a notification to all connected players.
trinity.notifyAll(data)Events
You can also trigger notifications via events:
-- Client-side
TriggerEvent('trinity-ui:notify', data)
-- Server to client
TriggerClientEvent('trinity-ui:notify', source, data)
TriggerClientEvent('trinity-ui:defaultNotify', source, data)ox_lib compatibility events ox_lib:notify and ox_lib:defaultNotify are also supported automatically.
Last updated on