vMenu Docs
API Reference

API Reference

Every public class, property, method and event in MenuAPI. Not set up yet? Start at Setup.

Every public class, property, method and event in MenuAPI. Not set up yet? Start at Setup.


The classes

ClassWhat it is
MenuA single menu: banner, subtitle, items and description box. Also where all events live.
MenuControllerThe static controller that registers, draws and controls your menus.
PaginationSplitting a long menu into pages, moved between with left and right.
GlobalInstructionalButtonsButton hints that belong to your resource instead of a menu, shown with or without a menu open.
Menu ItemsButtons, checkboxes, lists, dynamic lists and sliders.
EventsEvery event a menu can raise, with its parameters.
MenuTicksA read only view of the loops MenuAPI runs, and when each one stops.

Quick start

Examples in this reference use Legacy names (BaseScript, Debug.WriteLine). Setup shows the Enhanced equivalents.

using System.Collections.Generic;
using CitizenFX.Core;
using MenuAPI;

namespace MyResource
{
    public class MyMenu : BaseScript
    {
        public MyMenu()
        {
            // 1. Create a menu and register it with the controller.
            Menu menu = new Menu("My Resource", "Main Menu");
            MenuController.AddMenu(menu);

            // 2. Add some items.
            MenuItem button = new MenuItem("A button", "Press enter on me.");
            MenuCheckboxItem checkbox = new MenuCheckboxItem("A checkbox", "Toggle me.", false);
            MenuListItem list = new MenuListItem("A list", new List<string>() { "One", "Two", "Three" }, 0);

            menu.AddMenuItem(button);
            menu.AddMenuItem(checkbox);
            menu.AddMenuItem(list);

            // 3. React to what the user does.
            menu.OnItemSelect += (_menu, _item, _index) =>
            {
                if (_item == button)
                {
                    Debug.WriteLine("The button was pressed!");
                }
            };

            menu.OnCheckboxChange += (_menu, _item, _index, _checked) =>
            {
                Debug.WriteLine($"The checkbox is now {_checked}.");
            };

            // 4. Open it. (The menu toggle key, M by default, already opens the
            //    first registered menu for you, so this is only needed if you
            //    want your own trigger.)
            menu.OpenMenu();
        }
    }
}

Where to look for what

I want to…See
Create a menu, add or remove items, sort or filter themMenu
Show hundreds or thousands of items without endless scrollingPagination
Open, close or navigate a menu from codeMenu
Create a submenuMenuController.BindMenuItem()
Know which keys open and control the menu, and how players rebind themKey bindings
Open menus myself instead of using the toggle keyMenu.OpenMenu()
Move menus to the right side of the screenMenuController.MenuAlignment
Stop the user from closing a menuMenuController.PreventExitingMenu
Change the instructional buttons at the bottom of the screenMenu instructional buttons
Run my own code when a key is pressedKey bindings
Add an icon or right-hand text to an itemMenuItem
Attach my own data to an itemMenuItem.ItemData
Know which event fires for which item typeEvents
Show a weapon or vehicle stats panelMenu
See what MenuAPI is actually running, and whenMenuTicks

On this page