Menu

An input dialog to which you can add input fields

Example

menu.lua
RegisterCommand('menu', function()
  local menu = Menu:Create('Title', 'Description', 'top-right', '#fff');
  local subMenu = Menu:Create('Submenu Title', 'Description', 'top-right', '#ad43ff');
 
  subMenu:AddButton('Close', 'Close the example'):OnClick(function()
    Menu:Hide();
  end);
 
  menu:AddButton('Button', 'Description'):OnClick(function()
    print('Button clicked')
  end);
  menu:AddCheckbox('Checkbox', 'Description', true):OnCheck(function(checked)
    print('Is Checked', checked);
  end);
  menu:AddList('List', 'Description', { 'Item 1', 'Item 2', 'Item 3' }, 2):OnChange(function(current, index)
    -- current will be a string and index a number
    print(current, index);
  end);
  menu:AddPlaceholder('Placeholder');
  menu:AddSlider('Slider', 'Description', 20, 0, 30, 10):OnChange(function(current)
    -- current will be of type number
    print(current);
  end);
 
  menu:AddSubmenu(subMenu, 'Submenu', 'Description');
 
  menu:Show();
end, false);
fxmanifest.lua
fx_version 'cerulean'
game 'gta5'
lua54 'yes'
 
client_scripts {
  -- this import is needed to use the Menu variable in your resource
  '@monolith-menu/imports/menu.lua',
  'menu.lua'
}