Skip to Content

Context Menu

Structured menus with options, descriptions, and nested submenus.

Exports

ExportParametersReturns
RegisterContext(context)—
ShowContext(id)—
HideContext(onExit)—
GetOpenContextMenu()string or nil

RegisterContext Parameters

ParameterTypeRequiredDescription
idstringYesUnique menu identifier
titlestringYesMenu title
menustringNoParent menu ID (enables back button)
canClosebooleanNoWhether the menu can be closed with ESC
optionstableYesArray of menu options

Option Fields

FieldTypeDescription
titlestringOption label
descriptionstringDescription text below the title
iconstringFontAwesome icon name or image URL
iconColorstringCustom icon color
iconAnimationstringIcon animation: 'spin', 'beat', 'fade', 'bounce', 'shake'
arrowbooleanShow arrow indicator
progressnumberShow a progress bar (0–100)
colorSchemestringColor for the progress bar
imagestringImage URL shown on hover
metadatatableKey-value data shown on hover
disabledbooleanGrey out and disable the option
readOnlybooleanShow but prevent interaction
onSelectfunctionCallback when selected
menustringID of a submenu to open
eventstringClient event to trigger
serverEventstringServer event to trigger
commandstringConsole command to execute
argsanyArguments passed to event/callback

Usage

Register and Show

exports['flux-ui-pack']:RegisterContext({ id = 'my_menu', title = 'My Menu', options = { { title = 'Option 1', icon = 'check', onSelect = function() print('Selected option 1!') end }, { title = 'Option 2', description = 'This has a description', icon = 'gear' } } }) exports['flux-ui-pack']:ShowContext('my_menu')

With Events and Commands

exports['flux-ui-pack']:RegisterContext({ id = 'action_menu', title = 'Actions', options = { { title = 'Trigger Event', icon = 'bolt', event = 'myScript:doSomething', args = { id = 1 } }, { title = 'Server Action', icon = 'server', serverEvent = 'myScript:serverAction', args = { id = 1 } }, { title = 'Run Command', icon = 'terminal', command = 'status' } } })

With Metadata and Progress

exports['flux-ui-pack']:RegisterContext({ id = 'item_info', title = 'Item Details', options = { { title = 'Armor Vest', icon = 'shield', metadata = { { label = 'Durability', value = '75%', progress = 75 }, { label = 'Weight', value = '2.5kg' } }, progress = 75, colorScheme = 'green' } } })

With Submenus

exports['flux-ui-pack']:RegisterContext({ id = 'main_menu', title = 'Main Menu', options = { { title = 'Vehicle Options', menu = 'vehicle_menu' } } }) exports['flux-ui-pack']:RegisterContext({ id = 'vehicle_menu', title = 'Vehicle Options', menu = 'main_menu', -- Back button returns here options = { { title = 'Lock Vehicle', onSelect = function() end }, { title = 'Toggle Engine', onSelect = function() end }, } }) exports['flux-ui-pack']:ShowContext('main_menu')

Hide Context Menu

exports['flux-ui-pack']:HideContext()

Get Open Menu

local openMenu = exports['flux-ui-pack']:GetOpenContextMenu() if openMenu then print('Currently open: ' .. openMenu) end
Last updated on