Custom Context-Menu UI

Customizing the context-menu system used in Vanguard products.

Customize Context-Menu


How to create your Menu

  1. You need to add this on your menu script.

Menu = Vanguard.GetMenu()

if Menu == "lib" then
    Menu = lib
else
    Menu = Vanguard
end
  1. You need to register your menu on a function.

function OpenTestMenu()
    Menu.showContext('test_menu')
end
  1. You need to to create your menu.

Menu.registerContext({
    id = 'test_menu', -- Same id/name on Menu.showContext
    title = 'Test Menu', -- Your menu Title
    description = 'New menu for your server', -- Your menu Description (optional)
    canClose = true,  -- This menu can be closed? (Leave true always)
    options = {
        {
            title = 'Option 1', -- Your first option
            icon = 'fa-solid fa-shirt', -- Your option Icon 
            description = 'Click to open option 1', -- Your option description.
            onSelect = function() 
                print("you selected option 1") -- Here you put what this option can do. 
            end,
            canClose = true -- When you click, the menu closes automatically-
        },
        {
            title = 'Option 2',
            icon = 'fa-solid fa-tools',  
            description = 'Click to open option 2',
            onSelect = function()
                print("you selected option 2")
            end,
            canClose = false -- When clicking the menu remains open-
        }
    }
})
shared_scripts { '@Vanguard_Bridge/imports.lua' }
normal menu without selecting anything.
with mouse animation on selecting

Last updated