RE:CORD
REC_Notify

Stracture

Welcome to REC_Notify documentation.
Added
Updated
config/sh_config.lua

---@class REC_Notify.Shared.Config
local config = {}

---[[
---    Debug Mode
---]]
---@type boolean
config.debugMode = true

---[[
---     Look and behaviour of the notifications
---     The skin (rec / ox) follows config.theme of REC_Library
---]]
config.ui = {

    ---[[
    ---     Default position (each notification can override it with payload.position)
    ---]]
    ---@type REC_Notify.Shared.Enum.Position
    position = "top-right",

    ---[[
    ---     Maximum number shown at once per position
    ---     Anything over the limit waits in a queue until an older notification is gone
    ---]]
    ---@type integer
    maxVisible = 15,

    ---[[
    ---     Stack new notifications nearest the screen edge (false stacks them away from it)
    ---]]
    ---@type boolean
    newestOnTop = true,

    ---[[
    ---     Card width, distance from the screen edge and space between cards (CSS units)
    ---     nil keeps the value of the theme (rec: 320px / 1.5rem / 8px, ox: 300px / 16px / 8px)
    ---]]
    ---@type string|nil
    width = nil,
    offset = {
        ---@type string|nil
        x = nil,
        ---@type string|nil
        y = nil,
    },
    ---@type string|nil
    gap = nil,

    ---[[
    ---     Display time used when duration is omitted
    ---]]
    ---@type integer
    defaultDuration = 5000, -- ms

    ---[[
    ---     Enter and exit animation time
    ---]]
    ---@type integer
    animationDuration = 200, -- ms

    ---[[
    ---     Show the remaining time bar (each notification can override it with payload.showDuration)
    ---]]
    ---@type boolean
    showProgress = true,

    ---[[
    ---     Show the icon
    ---]]
    ---@type boolean
    showIcon = true,

    ---[[
    ---     Font size multiplier (1.0 is the default)
    ---]]
    ---@type number
    fontScale = 1.0,
}

---[[
---     Colour, icon and sound per notification type
---     color:    accent of the rec theme (the ox theme keeps the colour ox_lib gives the type unless the caller passes one)
---     icon:     a Font Awesome name ("circle-check") or class ("fa-solid fa-circle-check")
---     file:     an audio file in web/build/sounds/ (in development put it in web/public/sounds/ and run pnpm build)
---     frontend: a built-in GTA sound (used when mode = "frontend" and when the NUI could not play the file)
---     volume:   to change the volume for this type only (nil falls back to config.sound.volume)
---     set sound to nil to make this type silent
---]]
---@type table<REC_Notify.Shared.Enum.NotifyType, REC_Notify.Shared.Config.Type>
config.types = {
    success = {
        color = "#00ff88",
        icon = "circle-check",
        sound = {
            file = "success.wav",
            frontend = { set = "HUD_FRONTEND_DEFAULT_SOUNDSET", name = "SELECT", },
            volume = nil,
        },
    },
    error = {
        color = "#f87171",
        icon = "circle-xmark",
        sound = {
            file = "error.wav",
            frontend = { set = "HUD_FRONTEND_DEFAULT_SOUNDSET", name = "CANCEL", },
            volume = nil,
        },
    },
    info = {
        color = "#38bdf8",
        icon = "circle-info",
        sound = {
            file = "info.wav",
            frontend = { set = "HUD_FRONTEND_DEFAULT_SOUNDSET", name = "NAV_UP_DOWN", },
            volume = nil,
        },
    },
    warning = {
        color = "#facc15",
        icon = "circle-exclamation",
        sound = {
            file = "warning.wav",
            frontend = { set = "HUD_FRONTEND_DEFAULT_SOUNDSET", name = "FOCUSIN", },
            volume = nil,
        },
    },
    neutral = {
        color = "#cbd5e1",
        icon = "bell",
        sound = {
            file = "neutral.wav",
            frontend = { set = "HUD_FRONTEND_DEFAULT_SOUNDSET", name = "NAV_UP_DOWN", },
            volume = nil,
        },
    },
}

---[[
---     Sound settings
---     enabled = false silences every notification (it wins over the caller's playSound)
---]]
config.sound = {

    ---@type boolean
    enabled = true,

    ---[[
    ---     Default used when the caller omits playSound
    ---]]
    ---@type boolean
    default = true,

    ---[[
    ---     How to play it
    ---     "nui":      plays an audio file from web/build/sounds/ through NUI (the volume can be changed)
    ---     "frontend": plays a built-in GTA sound (no extra files needed)
    ---]]
    ---@type REC_Notify.Shared.Enum.SoundMode
    mode = "nui",

    ---[[
    ---     Volume (0.0 to 1.0)
    ---     Only used when mode = "nui"
    ---]]
    ---@type number
    volume = 0.4,
}

return config

---@class REC_Notify.Shared.Config.Type
---@field color string
---@field icon string
---@field sound REC_Notify.Shared.Config.Sound|nil
---@

---@class REC_Notify.Shared.Config.Sound
---@field file string|nil
---@field frontend REC_Notify.Shared.Config.Sound.Frontend|nil
---@field volume number|nil
---@

---@class REC_Notify.Shared.Config.Sound.Frontend
---@field set string
---@field name string
---@field bank string|nil
©2026 RE:CORD Development Group. All rights reserved.