ox_lib basics: notifications, menus and progress bars
Learn ox_lib basics for FiveM: install and start it, show notifications, build a simple menu and run a progress bar, with short examples from the official docs.
Short answer: ox_lib is a free library resource that gives your FiveM scripts a shared lib global. Add shared_script '@ox_lib/init.lua' to your resource, make sure ensure ox_lib appears before your resource in server.cfg, and then call lib.notify, lib.registerContext with lib.showContext, or lib.progressBar from your Lua code.
What ox_lib is
ox_lib (by Overextended) is a library resource. Scripts that load it get common helpers for interface work, such as notifications, context menus and progress bars. The official documentation lists each module and its options at overextended.dev/ox_lib.
Installing and starting ox_lib
- Download ox_lib from its GitHub releases page and place the folder in your server's resources folder.
- In the fxmanifest.lua of your own resource, import the library.
- In
server.cfg, start ox_lib before any resource that uses it. A resource that loads before ox_lib can fail because thelibglobal does not exist yet. For more on ordering, see resource start order, ensure lines and dependencies.
Example (fxmanifest.lua of your resource):
shared_scripts {
'@ox_lib/init.lua',
}
Example (server.cfg):
ensure ox_lib
ensure my_resource
Notifications
lib.notify(data) shows a notification on the client. The official docs say a title or a description is required. The defaults are type = 'inform', position = 'top-right' and duration = 3000. The accepted types are inform, error, success and warning.
Example (client script):
lib.notify({
title = 'Garage',
description = 'Your vehicle is ready.',
type = 'success'
})
To show a notification from the server, trigger the client event: TriggerClientEvent('ox_lib:notify', source, data), where data is the same table.
Menus
A context menu has two steps. lib.registerContext(context) registers the menu under an id, and lib.showContext(id) opens it. Each entry in options can use fields such as title, description and onSelect.
Example (client script):
lib.registerContext({
id = 'example_menu',
title = 'Example menu',
options = {
{
title = 'Say hello',
description = 'Shows a notification',
onSelect = function()
lib.notify({ description = 'Hello!', type = 'inform' })
end
}
}
})
RegisterCommand('examplemenu', function()
lib.showContext('example_menu')
end, false)
Progress bars
lib.progressBar(data) displays a running bar. The docs require duration and label. Optional fields include canCancel, useWhileDead and disable. The docs describe the call as asynchronous, and their example treats a finished bar as a truthy result and a cancelled bar as falsy. Two related helpers are lib.progressActive(), which returns true while a bar is running, and lib.cancelProgress(), which cancels a bar that can be cancelled.
Example (client script):
local finished = lib.progressBar({
duration = 5000,
label = 'Repairing...',
useWhileDead = false,
canCancel = true,
disable = { move = true, car = true }
})
if finished then
lib.notify({ description = 'Repair complete', type = 'success' })
end
Common mistakes
- Starting your resource before ox_lib. Put
ensure ox_libabove any resource that imports it. - Missing the import line. If
libis nil, check that theshared_scriptsline in your fxmanifest.lua is present and that the resource name is spelledox_lib. - Calling
lib.notifyon the server. It is a client function. UseTriggerClientEvent('ox_lib:notify', source, data)from the server. - Leaving out
titleanddescription. A notification needs at least one of them. - Opening a menu before registering it. Call
lib.registerContextfirst, thenlib.showContextwith the sameid.
FAQ
Can I call lib.notify from the server?
No. lib.notify runs on the client. From the server, trigger the ox_lib:notify client event with TriggerClientEvent.
Why does my menu not open?
Check that lib.registerContext runs before lib.showContext, and that both use the same id string.
Can a player cancel a progress bar?
Only if you set canCancel = true. Your script can check the state with lib.progressActive() and stop it with lib.cancelProgress().
Sources
- ox_lib documentation (overextended.dev)
- ox_lib notify
- ox_lib context menu
- ox_lib progress bar
- overextended/ox_lib on GitHub
Last checked: 30 November 2026
Note: The code above is a short example, not a complete script. Check field names against the current official documentation before you use them on a live server.
FiveM.tools was founded with sponsorship from Nyru.