DirkScripts Logo

Login With FiveM

Login

📚 Dirk Lib
â€ē
Modules
â€ē
ui
â€ē

Context

Context

Context Menus

lib.registerContext

Register a context menu that can be opened by ID

lua
lib.registerContext('my_menu', {
    title = 'Main Menu',
    icon = 'fa-bars',
    options = {
        {
            title = 'Option 1',
            description = 'Does something',
            icon = 'fa-cog',
            onSelect = function()
                print('selected!')
            end,
        },
        {
            title = 'Sub Menu',
            icon = 'fa-arrow-right',
            arrow = true,
            menu = 'my_sub_menu', -- opens another registered context
        },
    },
})
ParameterTypeRequiredDescription
idstringyesUnique menu identifier
datatableyesMenu definition (see below)
FieldTypeDescription
titlestringMenu header title
iconstringFontAwesome icon class
optionstable[]Array of menu options

Option Fields

FieldTypeDescription
titlestringOption label
descriptionstringSubtitle text
iconstringFontAwesome icon
onSelectfunctionCallback when selected
menustringID of a sub-menu to open
dialogstringID of a dialog to open
argsanyArguments passed to clientEvent / serverEvent
clientEventstringTrigger a client event when selected
serverEventstringTrigger a server event when selected
metadatatableKey-value pairs displayed as badges
disabledbooleanGrey out the option
arrowbooleanShow a right arrow
willClosebooleanForce option to close (or keep open) before callbacks

lib.openContext

Open a registered context menu

lua
lib.openContext('my_menu')

lib.closeContext

Close the currently open context menu

lua
lib.closeContext()

lib.getOpenContextMenu

Get the ID of the currently open context menu

lua
local id = lib.getOpenContextMenu()

lib.showContext / lib.hideContext

Show or hide the context menu without destroying it

lua
lib.showContext()
lib.hideContext()

Copyright Š 2026 DirkScripts.

Not affiliated with or endorsed by Rockstar North, Take-Two Interactive, or any other rights holders. FiveM is a copyright and registered trademark of Take-Two Interactive Software, Inc.
Our checkout system is provided by Tebex Limited, who manage payment processing, product delivery, and billing support. Prices shown in currencies other than GBP are approximate conversions updated daily. All purchases are processed in GBP, so the final amount charged may vary depending on your bank or payment provider’s exchange rate.

Daily dig available!

Hey you, you have free digs waiting

Dig Now