# Getting Started

### How to install MenuV

1. Download the latest stable [**release**](https://github.com/ThymonA/menuv/releases) of [**MenuV**](https://github.com/ThymonA/menuv) and place it in your resource folder.
2. Add **@menuv/menuv.lua** in your **fxmanifest.lua**

```lua
--- EXAMPLE: fxmanifest.lua

fx_version 'adamant'
game 'gta5'

client_scripts {
    '@menuv/menuv.lua',
    'example.lua'
}

dependencies {
    'menuv'
}
```

### Creating a basic menu

You can create a menu by using the **MenuV** class. This class provides 5 functions: **CreateMenu**, **GetMenu**, **OpenMenu**, **CloseMenu** and **CloseAll**.

**CreateMenu** has 8 parameters: **Title**, **Subtitle**, **Position**, **Red**, **Green**, **Blue**, **Icon** and **Size.**

```graphql
MenuV:CreateMenu(title: string, subtitle: string, position: string, r: number, g: number, b: number, icon: string, size: string)
```

#### Example

```lua
local menu = MenuV:CreateMenu('MenuV', 'Welcome to MenuV', 'topleft', 255, 0, 0)
```

Now you can start adding options to your menu by using the following functions: **AddButton**, **AddCheckbox**, **AddSlider**, **AddRange** and **AddConfirm.**

```lua
local button = menu:AddButton({ icon = '😃', label = 'Simple Button', value = 'YEA', description = 'Simple Button Description' })

local checkbox = menu:AddCheckbox({ icon = '😃', label = 'Simple Checkbox', value = false, description = 'Simple Checkbox Description' })

local slider = menu:AddCheckbox({ icon = '😃', label = 'Simple Slider', value = 1, description = 'Simple Slider Description', values = {
    { label = 'Option #1', value = 1 },
    { label = 'Option #2', value = 2 },
    { label = 'Option #3', value = 3 }
}})

local range = menu:AddRange({ icon = '😃', label = 'Simple Range', value = 0, description = 'Simple Range Description', min = 0, max = 10 })

local checkbox = menu:AddConfirm({ icon = '😃', label = 'Simple Confirm', value = false, description = 'Simple Confirm Description' })

local menu_button = menu:AddButton({ icon = '😃', label = 'Simple Menu Button', value = menu, description = 'Simple Menu Button Description' })
```

You can bind events by adding the name of events in the table while creating the item or after the item has been created and using the **On** function.

```lua
--- Bind event on item create function
local button = menu:AddButton({ icon = '😃', label = 'Simple Button', value = 'YEA', description = 'Simple Button Description', select = function(btn)
    print('YOU PRESSED THE BUTTON WITH VALUE ' .. btn.Value)
end})

--- Bind event after item has been created
local button = menu:AddButton({ icon = '😃', label = 'Simple Button', value = 'YEA', description = 'Simple Button Description' })

--- When user pressed `ENTER` on the button
button:On('select', function(btn)
    print('YOU PRESSED THE BUTTON WITH VALUE ' .. btn.Value)
end)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://thymona.gitbook.io/menuv-standalone-menu-for-fivem/getting-started.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
