# qb-menu

## Introduction

The **QB Menu** system is a Lua-based interactive menu integrated with a web-based user interface

{% hint style="success" %}
Menu icons can be found on the [Font Awesome](https://fontawesome.com/) website
{% endhint %}

### Features

* Dynamic menu creation
* Support for icons and images
* Menu sorting functionality
* Client-server communication
* Easy-to-use Lua and JavaScript interfaces
* Exports and events for extensive integration

## openMenu

Opens the menu with provided data

* data: `table`
  * header: `string` (optional)
  * txt: `string` (optional)
  * icon: `string` (optional)
  * isMenuHeader: `boolean` (optional)
  * disabled: `boolean` (optional)
  * hidden: `boolean` (optional)
  * action: `function`(optional)
  * params: `table` (optional)
    * event: `string`
    * args: `any` (optional)
    * isServer: `boolean` (optional)
    * isCommand: `boolean` (optional)
    * isQBCommand: `boolean` (optional)
    * isAction: `boolean` (optional)
* sort: `boolean`
* skipFirst: `boolean`

```lua
exports['qb-menu']:openMenu({
    { 
        header = "First Item", 
        icon = "icon-name", 
        txt = "Description",
        isMenuHeader = false,
        disabled = false,
        hidden = false,
        params = {
            event = "event:name",
            args = { arg1 = "value1" },
            isServer = false,
            isCommand = false,
            isQBCommand = false,
            isAction = false
        }
    },
    { 
        header = "Second Item", 
        txt = "Another description",
        isMenuHeader = false,
        disabled = true,
        hidden = false
    },
    {
        header = "Third Item", 
        txt = "Another description",
        action = function()
           print('You selected the Third Item')
        end
    }
       
}, true, false)
```

## closeMenu

Closes the menu

```lua
exports['qb-menu']:closeMenu()
```


---

# 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://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-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.
