Notification
Notifications with customizable positioning, styling and more
Options
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | No | nil | Unique identifier - when provided will only show once when spammed or update the same notification |
title | string | No | nil | Notification title (supports markdown) |
message | string | Yes* | nil | Notification message (supports markdown) |
type | string | No | 'info' | Type: 'info', 'success', 'warning', 'error' |
duration | number | No | 5000 | Duration in milliseconds |
position | string | No | 'top-right' | Position: 'top-left', 'top', 'top-right', 'center-left', 'center-right', 'bottom-left', 'bottom', 'bottom-right' |
icon | string | No | nil | FontAwesome icon class |
iconColor | string | No | Auto | Icon color (hex or CSS color name) |
bgColor | string | No | Auto | Background color (hex or CSS color name) |
txtColor | string | No | Auto | Text color (hex or CSS color name) |
sound | table | No | nil | Sound configuration (see Sound Options) |
*Either title or message is required.
Notes:
'description'is an alias for'message'.'top'is an alias for'top-center'.
Sound Options
The sound parameter is a table with the following properties:
| Property | Type | Required | Description |
|---|---|---|---|
bank | string | No | Name of audio bank that contains the soundset |
set | string | Yes | Soundset the soundname is a member of |
name | string | Yes | Sound name to play |
Server-Side Usage
To send notifications from the server, use the client event:
TriggerClientEvent('lation_ui:notify', source, data)source- The player’s IDdata- Notification data table (see Options above)
Example
exports.lation_ui:notify({
title = 'Success',
message = 'Profile updated successfully',
type = 'success',
})
exports.lation_ui:notify({
title = 'Error',
message = 'Failed to save changes',
type = 'error',
})
exports.lation_ui:notify({
title = 'Warning',
message = 'Your session is about to expire',
type = 'warning',
})
exports.lation_ui:notify({
title = 'Info',
message = 'New features are now available',
type = 'info',
})
exports.lation_ui:notify({
message = 'A notification with only a message',
})
exports.lation_ui:notify({
title = 'Custom',
message = 'A notification with custom styles',
bgColor = '#e35c5c',
icon = 'fas fa-screwdriver-wrench',
iconColor = '#3a3a3a',
txtColor = '#e5e5e5',
})
exports.lation_ui:notify({
title = 'Custom',
message = 'A notification with custom styles',
bgColor = '#bd71f2',
icon = 'fas fa-bars',
iconColor = '#3a3a3a',
txtColor = '#e5e5e5',
})