UI Library
Notifications
Toasts that stack in a screen corner and dismiss themselves. Non-blocking: the export returns immediately.

notify
exports.of_ui:notify(data)| Field | Type | Description |
|---|---|---|
title | string? | Bold first line. |
description | string? | Second line. At least one of title / description is needed for a useful toast. |
type | string? | info (default), success, warning, error. inform is accepted as an alias for info. |
duration | number? | Milliseconds on screen. Falls back to the player's theme when omitted. |
position | string? | top, top-right, top-left, bottom, bottom-right, bottom-left. Theme decides when omitted. |
icon | string|table? | Font Awesome icon name, overriding the one implied by type. |
iconColor | string? | Hex colour for the icon. |
iconAnimation | string? | Font Awesome animation, e.g. beat, fade, spin. |
alignIcon | string? | top or center. |
id | string|number? | Reuses the toast with this id instead of stacking a new one. |
style | table? | Inline CSS applied to the toast. |
sound | table? | { bank?: string, set: string, name: string }: played once as the toast appears. |
Examples
exports.of_ui:notify({
type = 'success',
title = 'Vehicle stored',
description = 'Sultan RS, Legion garage',
})A warning that stays longer and plays a game sound:
exports.of_ui:notify({
type = 'warning',
title = 'Engine damaged',
description = 'Repair it before continuing',
duration = 8000,
sound = { set = 'HUD_FRONTEND_DEFAULT_SOUNDSET', name = 'ERROR' },
})Custom icon and accent, ignoring the type preset:
exports.of_ui:notify({
title = 'New contract',
description = 'Check the shop board',
icon = 'file-signature',
iconColor = '#6c63ff',
iconAnimation = 'beat',
})From the server
The client listens on of_ui:client:notify, so a server script can notify a player directly:
TriggerClientEvent('of_ui:client:notify', source, {
type = 'error',
title = 'Not enough money',
description = 'You are $2,400 short',
})sound is played client-side. If you send it from the server, the sound plays on that one player's machine only, which is normally what you want.
