# context menu

{% hint style="info" %} <mark style="color:yellow;">Fontawesome</mark> is used to add icons to the list items, you can find the code [here](https://fontawesome.com/v5/search?o=r\&m=free).
{% endhint %}

## Context Menu

<figure><img src="https://share.lvsoft.com.ar/images/JxVCa.jpg" alt=""><figcaption></figcaption></figure>

***

### How to use:

Client-side using exports

**Example:**

```lua
-- menu table
local menu = {
	{
		header = "Item #1",
		txt = "This trigger an event",
		icon = "fas fa-user", -- add icon to item
		--disabled = true, -- make item disabled
		params = {
			event = "event:client:test1",
			args = {
				number = 1,
			}
		}
	},
	{
		header = "Item #2",
		txt = "Can trigger a  server event",
		params = {
			event = "qb-menu:server:test2",
			isServer = true,
			args = {
				number = 2,
			}
		}
	},
	{
		header = "Item #3",
		txt = "Can trigger a function",
		params = {
			event = function(args)
				print(json.encode(args))
			end,
			isAction = true,
			args = {
				number = 3,
			}
		}
	},
}

-- open context menu
exports.lvs_lib:openContext('Menu Title', menu)


-- close context menu
exports.lvs_lib:closeContext()
```

***

### qb-menu replacement

To replace <mark style="color:orange;">qb-menu</mark> with this script, you need to enable the functionality in the `config.lua` and remove a comment in the `fxmanifest.lua`

{% code title="fxmanifest.lua (line 58)" %}

```lua
provide 'qb-menu'
```

{% endcode %}

{% code title="config.lua" %}

```lua
--- ### CONTEXT ###
-- make lvs context menu replace of qb-menu
-- uncomment line 57 on fxmanifest.lua [provide 'qb-menu']
-- remove qb-menu
Config.ContextAsQBMenu = true
Config.QBMenuCommand = {
    name = 'playerfocus',
    description = 'Give Menu Focus',
    key = 'Alt',
    keymapping = 'LMENU'
}
```

{% endcode %}


---

# 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://fivem.lvsoft.com.ar/qb-esx/lvs-lib/context-menu.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.
