Exports
All exports are called as exports.np_menu:<name>(...). The OOP wrapper wraps the menu exports in an object.
Client
client
Menus
| Export | Returns | Description |
|---|---|---|
register(def) | id | nil | Register or replace a menu. See Creating menus |
open(id, opts?) | boolean | Open a menu. opts = { selectedId?, keepStack? } |
close(reason?) | boolean | Close the whole list / grid stack |
back() | boolean | Go back one level (closes the root if canClose) |
isOpen() | boolean | A list / grid menu is open |
getOpenId() | id | nil | The menu on top of the stack |
inStack(id) | boolean | id is anywhere in the open stack |
exists(id) | boolean | id is registered |
remove(id) | boolean | Close it if visible, then unregister |
refresh(id?) | Re-render the visible menu (re-evaluates permissions and format) | |
update(id, patch) | boolean | Patch 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) | boolean | Replace all rows |
addItem(id, item, index?) | itemId | nil | Append, or insert at index |
removeItem(id, itemId) | boolean | |
updateItem(id, itemId, patch) | boolean | Patch one row. false clears a field (badge, cooldown, rightLabel, …) |
getItem(id, itemId) | WireItem | nil | Serialized copy of the row (no functions) |
setPreview(id, card | nil) | boolean | Preview card next to the menu |
setCart(id, cart | nil) | boolean | Cart footer { label, total, action } |
Dialogs and toasts
| Export | Returns | Description |
|---|---|---|
inputDialog(def) | values | nil | Blocking. { [fieldId] = value }, nil when cancelled. See Dialogs |
confirm(def | message) | boolean | Blocking. |
notify(data) / notify(title, type?) | boolean | Toast { type, title, message?, icon?, tint?, duration?, app? } |
clipboard(text) | boolean | Copy text to the player's clipboard |
Radial and context
| Export | Returns | Description |
|---|---|---|
addRadial(context, item) | id | context: string or list. See Radial wheel |
removeRadial(id) | boolean | |
setRadialContext(fn) | boolean | Add a provider fn(info) -> 'context' | { … } | nil |
openRadial(context?) | boolean | Open the wheel from code |
closeRadial() | boolean | |
isRadialOpen() | boolean | |
showContext(def | menuId, entity | vector3) | id | nil | World-anchored context menu. See Context menus |
closeContext() | boolean | |
isContextOpen() | boolean | |
addContextOption(entityType, option) | id | nil | Only with the built-in context menu. See addContextOption |
removeContextOption(id) | boolean |
Settings and server
| Export | Returns | Description |
|---|---|---|
getSettings() | table | Merged 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
| Export | Returns | Description |
|---|---|---|
registerAction(name, opts) | boolean | Register 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)
| Event | Arguments | Fired after |
|---|---|---|
np_menu:shops:tuningBought | src, netId, changes, price | A tuning purchase |
np_menu:shops:clothingBought | src, changes, price | A clothing purchase |
np_menu:interact:impounded | src, plate, model | An impound from the context menu |
These are local server events, fired only after the server validated the action.
Commands
| Command | Side | Description |
|---|---|---|
devmenu | client | Toggle the dev / admin menu (F10) |
quickmenu | client | Toggle the quick menu (F1) |
menusettings | client | Open the settings menu |
+np_menu_radial, +np_menu_context, +np_menu_cursor, +np_menu_shopcam | client | Key mappings (hold radial, hold context, cursor toggle, shop camera) |
npmenu_aces_reset | server | Console or admin: every client re-queries its aces |