lation scripts
scriptsmembershipdocs
see the scripts
Skip to Content
lation ui
ThemingConfigurationChangelog

Developer API

Shared optionsNotificationsProgress barAlert dialogInput dialogContext menuList menuRadial menuText UITimelineDrawerMinigames
lation interact
lation banking
lation shops
lation jobs
lation weed
lation chop shop

classics

money laundering
drug sales
coke processing
meth crafting
metal detecting
scuba diving
lation ui

Context menu

Register and show lation ui context menus with submenus, icons, images, metadata, progress bars, keybinds and select callbacks.

A context menu is a clickable list of options in a panel. Options can run a function, trigger an event, open a submenu, show a progress bar, or show an image and details when highlighted. While a context menu is open it takes the mouse and keyboard.

You register a menu once with an id, then show it by that id.

A context menu titled Garage, Pick a vehicle, with a highlighted Sultan RS row and its fuel bar, an Impounded vehicles row with an arrow, a read-only Garage full row, and a card beside it reading Fuel 64% and Engine 92%
The Garage example, its first option pointed at

registerMenu

Client export

exports.lation_ui:registerMenu(menu)

Parameters

menu.idstring
A unique menu id
menu.titlestringoptional
The header's title
menu.subtitlestringoptional
A line under the title
menu.headerIconstringoptional
An icon or image URL on the right of the header
menu.headerIconColorstringoptional
The header icon's color. The theme's icon color by default.
menu.headerIconAnimationstringoptional
See icon animations
menu.menustringoptional
The id of the parent menu. Adds a back button to the header and lets Backspace go back.
menu.positionstringoptionaldefault 'top-right'
'top-left', 'top-right', 'offcenter-left' or 'offcenter-right'. A submenu without one uses its parent's.
menu.canClosebooleanoptionaldefault true
Lets Escape close the menu. When false, the footer asks the player to pick an option.
menu.onExitfunctionoptional
Runs when the menu is closed. See onExit.
menu.onBackfunctionoptional
Runs when the player goes back to the parent. See onBack.
menu.optionstableoptional
The list of options

Pass a list of menus to register several in one call. Registering an id again replaces the old menu. It raises an error when menu isn't a table or has no id.

The header, with the back button and the header icon, shows only when the menu has a title or subtitle; Backspace goes back either way. title, subtitle and each option's title and description take text formatting.

options can also be a table keyed by option title, as ox_lib takes it. lation ui turns it into a list, but Lua doesn't keep the order of a keyed table, so use a list when the order matters.

Options

FieldTypeDefaultDescription
titlestringThe option's title.
descriptionstringSmaller text under the title.
iconstringAn icon or image URL.
iconColorstringTheme icon colorThe icon's color.
iconAnimationstringSee icon animations.
onSelectfunctionRuns when the option is selected. See onSelect.
eventstringA client event to trigger when selected, with args.
serverEventstringA server event to trigger when selected, with args.
argsanyPassed to onSelect, event and serverEvent.
menustringThe id of a registered menu to open when selected. Shows an arrow.
shouldClosebooleantruefalse keeps the menu open after the option runs.
disabledbooleanfalseGreyed out and can't be selected.
readOnlybooleanfalseShown normally but can't be selected.
keybindstringA key shown on the option. Pressing it while the menu is open selects the option. Not shown on an option with menu.
progressnumber0 to 100. Shows a bar under the title.
progressColorstringTheme icon colorThe bar's color. colorScheme works too.
imagestringAn image URL shown in a card beside the menu while the option is highlighted.
metadatatableLines shown in the same card. See metadata.
A context menu titled Vehicle Menu: Open Trunk highlighted, with its description and an E keybind; Vehicle Options with an arrow; a read-only Fuel Level row with a bar; and Lock Vehicle, dimmed and disabled
A keybind, a submenu arrow, a read-only bar and a disabled option

An option can use onSelect, event and serverEvent together; they run in that order. An option with menu opens that menu and runs none of them. An option with none of them and no menu does nothing when selected.

Metadata

metadata takes any of these shapes:

-- Plain lines
metadata = { 'Owner: Lation', 'Plate: LATN 01' }

-- Label and value pairs, each with an optional bar
metadata = {
    { label = 'Fuel', value = '64%', progress = 64, progressColor = '#10B981' },
    { label = 'Mileage', value = 12840 }
}

-- A keyed table, shown as "key: value"
metadata = { Owner = 'Lation', Plate = 'LATN 01' }

Callbacks

onSelect

Callback

onSelect = function(args) end

Parameters

argsany
The option's args

Runs when the player clicks the option, presses Enter on it or presses its keybind. The menu closes first, unless the option has shouldClose = false.

onExit

Callback

onExit = function() end

Runs when the player closes the menu with Escape, or when your script calls hideMenu(true). It doesn't run when the menu closes because an option was selected.

onBack

Callback

onBack = function() end

Runs when the player goes back to the parent menu with the back button or Backspace, just before the parent opens.

showMenu

Client export

exports.lation_ui:showMenu(id)

Parameters

idstring
A registered menu's id

Opens the menu, in place of any context menu already open. It raises an error if no menu has that id.

hideMenu

Client export

exports.lation_ui:hideMenu(onExit)

Parameters

onExitbooleanoptionaldefault false
true also runs the open menu's onExit

Closes the open menu and gives the mouse and keyboard back.

client.lua
exports.lation_ui:hideMenu(true)

getOpenMenu

Client export

local id = exports.lation_ui:getOpenMenu()

Returns

string | nil
The id of the open menu, or nil
client.lua
if exports.lation_ui:getOpenMenu() == 'garage_menu' then
    exports.lation_ui:hideMenu()
end

Controls

InputAction
MouseHover and click options.
Arrow Up and DownMove the highlight, skipping disabled and read-only options. Wraps at the ends.
Home and EndJump to the first or last option.
EnterSelect the highlighted option.
BackspaceGo back to the parent menu.
EscapeClose the menu, unless canClose is false.
An option's keybindSelect that option.

Example

client.lua
exports.lation_ui:registerMenu({
    id = 'garage_menu',
    title = 'Garage',
    subtitle = 'Pick a vehicle',
    headerIcon = 'fas fa-warehouse',
    options = {
        {
            title = 'Sultan RS',
            description = 'Plate LATN 01',
            icon = 'fas fa-car',
            progress = 64,
            progressColor = '#10B981',
            metadata = {
                { label = 'Fuel', value = '64%' },
                { label = 'Engine', value = '92%' }
            },
            serverEvent = 'my_garage:takeOut',
            args = { plate = 'LATN 01' }
        },
        {
            title = 'Impounded vehicles',
            icon = 'fas fa-ban',
            menu = 'garage_impound'
        },
        {
            title = 'Garage full',
            icon = 'fas fa-circle-info',
            readOnly = true
        }
    }
})

exports.lation_ui:registerMenu({
    id = 'garage_impound',
    title = 'Impound',
    menu = 'garage_menu',
    options = {
        {
            title = 'Pay release fee',
            description = '$500',
            icon = 'fas fa-dollar-sign',
            keybind = 'E',
            onSelect = function(args)
                print('Paying fee for', args.plate)
            end,
            args = { plate = 'LATN 02' }
        }
    }
})

exports.lation_ui:showMenu('garage_menu')
The Impound submenu: a back arrow before its title, and one option pointed at, Pay release fee, $500, with an E keybind
The Impound submenu, opened from Impounded vehicles

Still stuck? Ask in our Discord: the people who write the scripts answer.

Last updated November 9, 2026

Input dialog

Collect values from the player with a lation ui input dialog, with text, number, toggle, select, slider, color, date and date range fields and checks on submit.

List menu

Register and show keyboard-driven lation ui list menus with side-scroll values, checkboxes, progress bars and callbacks for every change.

On this page

registerMenuOptionsMetadataCallbacksonSelectonExitonBackshowMenuhideMenugetOpenMenuControlsExample
lation scripts

FiveM scripts for Qbox, QBCore and ESX servers, made to look and work like one product.

store

  • all scripts
  • membership
  • classics

help

  • docs
  • discord
  • email support

legal

  • terms
  • refunds
  • privacy
© 2026 Lation Labslationscripts.com
  • home
  • scripts
  • membership
  • docs