Exports & Functions
All UI components can be driven using either direct exports from the nxs_ui resource or standard ox_lib wrapper overrides (which are active when @nxs_ui/init.lua is loaded).
1. Notifications
Displays toast messages with custom headings, messages, placement, and animated icons.
notify
Side: Client & Server
exports.nxs_ui:notify({
title = 'Success',
description = 'Operation completed successfully!',
type = 'success', -- 'info' | 'warning' | 'success' | 'error'
position = 'top-right', -- Optional default override
duration = 5000, -- Duration in ms
icon = 'check', -- FontAwesome icon name
iconAnimation = 'beat', -- 'spin' | 'pulse' | 'beat' | 'fade' | 'bounce' | etc.
iconColor = '#2ecc71',
showDuration = true -- Show progress/duration bar
})Note: On the server side, the first argument is the playerId target (e.g. exports.nxs_ui:notify(playerId, { ... })).
2. Context Menu
Creates nested menus aligned with glass-morphic surfaces. Supports lists, progress indicators, item descriptions, and status metadata.
registerContext
Registers a single menu configuration or an array of menus.
Side: Client
lib.registerContext({
id = 'vehicle_menu',
title = 'Vehicle Manager',
canClose = true,
options = {
{
title = 'Spawn Zentorno',
description = 'Spawns a vehicle with metadata',
icon = 'car',
metadata = {
{ label = 'Model', value = 'Zentorno' },
{ label = 'Fuel', value = '80%' },
{ label = 'Condition', value = 'Excellent' }
},
onSelect = function()
-- Custom action
end
},
{
title = 'Lock Vehicle',
icon = 'lock',
serverEvent = 'vehicle:lock',
args = { plate = 'XYZ 123' }
},
{
title = 'Open Submenu',
description = 'Configure vehicle systems',
menu = 'vehicle_sub_menu', -- Target menu ID
arrow = true
}
}
})showContext
Opens a registered context menu by its unique ID.
lib.showContext('vehicle_menu')3. Input Dialog
Displays interactive form fields.
Side: Client
local input = lib.inputDialog('Character Creator', {
{ type = 'input', label = 'First Name', placeholder = 'John', icon = 'user', required = true },
{ type = 'number', label = 'Age', icon = 'cake-candles', default = 21, min = 18, max = 99 },
{ type = 'select', label = 'Gender', icon = 'venus-mars', options = {
{ value = 'male', label = 'Male' },
{ value = 'female', label = 'Female' }
}},
{ type = 'slider', label = 'Strength', default = 50, min = 0, max = 100 },
{ type = 'checkbox', label = 'Accept Terms', required = true }
})
if input then
local firstName = input[1]
local age = input[2]
-- process inputs
end4. List Menu
Constructs vertical lists with scrollable values and checkboxes.
registerMenu
Side: Client
lib.registerMenu({
id = 'system_settings',
title = 'System Settings',
position = 'top-left',
options = {
{ label = 'HUD Display', checked = true },
{ label = 'Theme Mode', values = { 'Light', 'Dark', 'Automatic' }, defaultIndex = 2 },
{ label = 'Confirm Selection', close = true, args = { action = 'save' } }
},
onSideScroll = function(selected, scrollIndex, args)
print('Scroll changed - option:', selected, 'index:', scrollIndex)
end,
onCheck = function(selected, checked, args)
print('Checked state changed:', checked)
end
}, function(selected, scrollIndex, args)
print('Finalized option index selected:', selected)
end)
lib.showMenu('system_settings')5. Alert Dialog
Prompts the user with structured modal dialogs. Supports markdown.
alertDialog
Side: Client
local result = lib.alertDialog({
header = 'Warning',
content = 'Are you sure you want to delete this character? This action **cannot** be undone.',
centered = true,
cancel = true,
labels = {
confirm = 'Proceed',
cancel = 'Abort'
}
})
if result == 'confirm' then
-- confirmed action
end6. Progress
Creates loading bars or radial timers overlaid on the HUD. Automatically blocks actions based on config.
progressBar / progressCircle
Side: Client
local completed = lib.progressBar({
duration = 5000,
label = 'Hotwiring Vehicle...',
canCancel = true,
disable = {
move = true,
car = true,
combat = true
},
anim = {
dict = 'anim@amb@clubhouse@tutorial@bkr_tut_ig3@',
clip = 'machinic_loop_mechandplayer'
},
prop = {
model = 'prop_tool_screwdriver',
bone = 60309,
pos = vector3(0.1, 0.05, 0.0),
rot = vector3(0.0, 0.0, 0.0)
}
})
if completed then
-- task completed successfully
end7. Radial Menu
Displays interactive circular selection wheels. Supports sub-menus and keep-open commands.
addRadialItem
Side: Client
-- Add items to the main radial wheel
lib.addRadialItem({
{
id = 'radial_vehicle',
icon = 'car',
label = 'Vehicles',
menu = 'radial_vehicle_submenu' -- Name of submenu registered via lib.registerRadial
},
{
id = 'radial_heal',
icon = 'heart',
label = 'Apply Bandage',
keepOpen = false,
onSelect = function()
-- run bandage logic
end
}
})8. Skill Check
Starts timed quick-time event mini-games.
skillCheck
Side: Client
-- Triggers a chain: easy, followed by medium, followed by hard
local success = lib.skillCheck({ 'easy', 'medium', 'hard' }, { 'w', 'a', 's', 'd' })
if success then
-- Hotwire success!
else
-- Tool broke!
end9. Text UI
Displays tooltips and keyboard shortcuts on the HUD.
showTextUI / showMultiKeyTextUI
Side: Client
-- Simple Text UI
lib.showTextUI('[E] - Enter Garage', {
position = 'right-center',
icon = 'warehouse'
})
-- Multi-key Controls List
exports.nxs_ui:showMultiKeyTextUI({
{ key = 'E', label = 'Enter Vehicle', icon = 'door-open' },
{ key = 'F', label = 'Exit Vehicle', icon = 'door-closed' },
{ key = 'G', label = 'Toggle Engine', icon = 'power-off' }
}, {
title = 'Vehicle Controls',
position = 'right-center'
})
-- Hide when out of range
lib.hideTextUI()