Installation
To enable the ox_lib library inside of your resource, add@ox_lib/init.lua as a shared_script in your fxmanifest.lua file:
fxmanifest.lua
Make sure ox_lib is started before any resources that depend on it in your server.cfg!
Building the UI
For advanced UI building with ox_lib, please visit the official documentation:- Ox_Lib Docs: https://overextended.dev/ox_lib#building-the-ui
- UI Components: https://overextended.dev/ox_lib/Interface/Client/context
- Input Dialogs: https://overextended.dev/ox_lib/Modules/Interface/Client/input
Context Menus
Context menus provide an intuitive way to display multiple options to players.Registering a Context Menu
Uselib.registerContext to define a menuโs structure:
Menu Options Properties
- title
string- The display text for the option - description
string(optional) - Additional information shown below the title - icon
string(optional) - Font Awesome icon class (e.g.,'fa-solid fa-box') - iconColor
string(optional) - Hex color for the icon (e.g.,'#C53030') - event
string(optional) - Client event to trigger when selected - serverEvent
string(optional) - Server event to trigger when selected - onSelect
function(optional) - Function to execute when selected - args
any(optional) - Arguments to pass to the event/function - arrow
boolean(optional) - Shows an arrow indicator - menu
string(optional) - ID of another menu to open - disabled
boolean(optional) - Greys out and disables the option - metadata
table(optional) - Additional data displayed on the right side
Showing a Menu
Display a registered menu usinglib.showContext:
Complete Example
Notifications
Custom notifications with extensive styling options.Client-Side Notifications
Server-Side Notifications
Notification Properties
- title
string(optional) - The notification title - description
string- The main notification message - type
string- Type of notification:'success','error','warning','info' - icon
string(optional) - Font Awesome icon class - iconColor
string(optional) - Hex color for the icon - iconAnimation
string(optional) - Animation:'spin','shake','beat','fade','bounce' - duration
number(optional) - Duration in milliseconds (default: 5000) - position
string(optional) - Position:'top','top-right','top-left','bottom','bottom-right','bottom-left','center-right','center-left'
Notification Types Examples
Input Dialogs
Request user input with customizable forms.Basic Input Dialog
Multi-Field Input
Input Types
Text Input:Progress Bars
Display progress for actions.Basic Progress Bar
Progress with Animation
Localization
Text elements support multi-language via locale files.Setup Localization
- Add to fxmanifest.lua:
- Create locale files (e.g.,
locales/en.json):
- Use in code:
Always use locales for multi-language support! Make sure to call
lib.locale() at the top of your script if needed.Alert Dialogs
Simple confirmation dialogs.Useful Utilities
Request Model
Request Animation Dictionary
Best Practices
Use locales from the start: Itโs easier to add translations early than to retrofit them later
Performance Tips
- Request resources once: Donโt request the same model/animation repeatedly
- Clean up resources: Always call
SetModelAsNoLongerNeededandRemoveAnimDict - Use progress bars for long actions: Improves player experience
- Cache frequently used data: Donโt query the same data repeatedly
For more advanced features, visit the official ox_lib documentation: https://overextended.dev/ox_lib