Skip to content

Exports ​

All exports are called as exports.np_menu:<name>(...). The OOP wrapper wraps the menu exports in an object.

Client ​

client

ExportReturnsDescription
register(def)id | nilRegister or replace a menu. See Creating menus
open(id, opts?)booleanOpen a menu. opts = { selectedId?, keepStack? }
close(reason?)booleanClose the whole list / grid stack
back()booleanGo back one level (closes the root if canClose)
isOpen()booleanA list / grid menu is open
getOpenId()id | nilThe menu on top of the stack
inStack(id)booleanid is anywhere in the open stack
exists(id)booleanid is registered
remove(id)booleanClose it if visible, then unregister
refresh(id?)Re-render the visible menu (re-evaluates permissions and format)
update(id, patch)booleanPatch header fields (title, subtitle, icon, tint, position, skin, search, searchDeep, counter, canClose, preview, cart, tag, callbacks, allowDead). items / dock replace those lists
setItems(id, items)booleanReplace all rows
addItem(id, item, index?)itemId | nilAppend, or insert at index
removeItem(id, itemId)boolean
updateItem(id, itemId, patch)booleanPatch one row. false clears a field (badge, cooldown, rightLabel, …)
getItem(id, itemId)WireItem | nilSerialized copy of the row (no functions)
setPreview(id, card | nil)booleanPreview card next to the menu
setCart(id, cart | nil)booleanCart footer { label, total, action }

Dialogs and toasts ​

ExportReturnsDescription
inputDialog(def)values | nilBlocking. { [fieldId] = value }, nil when cancelled. See Dialogs
confirm(def | message)booleanBlocking.
notify(data) / notify(title, type?)booleanToast { type, title, message?, icon?, tint?, duration?, app? }
clipboard(text)booleanCopy text to the player's clipboard

Radial and context ​

ExportReturnsDescription
addRadial(context, item)idcontext: string or list. See Radial wheel
removeRadial(id)boolean
setRadialContext(fn)booleanAdd a provider fn(info) -> 'context' | { … } | nil
openRadial(context?)booleanOpen the wheel from code
closeRadial()boolean
isRadialOpen()boolean
showContext(def | menuId, entity | vector3)id | nilWorld-anchored context menu. See Context menus
closeContext()boolean
isContextOpen()boolean
addContextOption(entityType, option)id | nilOnly with the built-in context menu. See addContextOption
removeContextOption(id)boolean

Settings and server ​

ExportReturnsDescription
getSettings()tableMerged player settings. See Theming & settings
setSetting(key, value)boolean, err?nil resets the key to its default
callServer(name, payload?, opts?)ok, data | code, message?Blocking server action call. opts = { silent?, timeout? }. See Server actions
lua
exports.np_menu:register({ id = 'demo', title = 'Demo', items = { { type = 'button', id = 'hi', label = 'Hello' } } })
exports.np_menu:open('demo')
exports.np_menu:updateItem('demo', 'hi', { badge = 3 })

CreateThread(function()
  local name = exports.np_menu:inputDialog({ title = 'Name', fields = { { id = 'n', label = 'Name', required = true } } })
  if name then exports.np_menu:notify({ type = 'success', title = 'Hi ' .. name.n }) end
end)

With Config.OxCompat = true there are more exports with ox_lib signatures. See ox_lib compatibility.

Events ​

Local client events (AddEventHandler): np_menu:opened, np_menu:closed, np_menu:selected, np_menu:changed, np_menu:radialOpened, np_menu:contextOpened, np_menu:contextClosed, np_menu:settingChanged. See Creating menus → Events.

Server ​

server

ExportReturnsDescription
registerAction(name, opts)booleanRegister a server action. See Server actions
removeAction(name)boolean
notify(source, data)Toast on one client
closeMenus(source)Close every np_menu surface on that client (-1 = everyone)
resetAce(source?)Clients re-query their ace permissions
lua
exports.np_menu:notify(source, { type = 'info', title = 'Garage', message = 'Your car is **ready**.', icon = 'car' })
exports.np_menu:closeMenus(source)

Server events (built-in menus) ​

EventArgumentsFired after
np_menu:shops:tuningBoughtsrc, netId, changes, priceA tuning purchase
np_menu:shops:clothingBoughtsrc, changes, priceA clothing purchase
np_menu:interact:impoundedsrc, plate, modelAn impound from the context menu

These are local server events, fired only after the server validated the action.

Commands ​

CommandSideDescription
devmenuclientToggle the dev / admin menu (F10)
quickmenuclientToggle the quick menu (F1)
menusettingsclientOpen the settings menu
+np_menu_radial, +np_menu_context, +np_menu_cursor, +np_menu_shopcamclientKey mappings (hold radial, hold context, cursor toggle, shop camera)
npmenu_aces_resetserverConsole or admin: every client re-queries its aces

np_* FiveM resources