# Radial Menu

* Radial menu has a global menu that's by default accessed with `z` and only displays when there is at least one item.
* You can add and remove items from the global menu using `lib.addRadialItem` and `lib.removeRadialItem`.
* Use `lib.registerRadial` for creating sub menus and use the `menu` property on the items to open those sub menus.

#### lib.addRadialItem <a href="#libaddradialitem" id="libaddradialitem"></a>

Item or array of items added to the global radial menu.

```lua
lib.addRadialItem(items)
```

* id: `string`
  * Id that is used for removing options.
* icon: `string`
* label: `string`
  * Label uses  to insert a newline
* menu?: `string`
  * Id of a menu to open.
* onSelect: `function(currentMenu: string | nil, itemIndex: number)` | `string`
  * Function that's ran when a user clicks the item.
* keepOpen?: `boolean`

#### lib.removeRadialItem <a href="#libremoveradialitem" id="libremoveradialitem"></a>

Id of an item to be removed from the global menu

```lua
lib.removeRadialItem(item)
```

* id: `string`

#### lib.clearRadialItems <a href="#libclearradialitems" id="libclearradialitems"></a>

Removes all items from the radial menu.

```lua
lib.clearRadialItems()
```

#### lib.registerRadial[​](https://overextended.github.io/docs/ox_lib/Modules/Interface/Client/radial#libregisterradial) <a href="#libregisterradial" id="libregisterradial"></a>

Registers a radial sub menu with predefined options.

```lua
lib.registerRadial(radial)
```

* id: `string`
  * Unique menu id used to open with `menu` prop on an item.
* items: `array`
  * icon: `string`
  * label: `string`
    * Label uses  to insert a newline
  * menu?: `string`
    * Id of a menu to open.
  * onSelect?: `function(currentMenu: string | nil, itemIndex: number)` | `string`
    * Function that's ran when a user clicks the item.

#### lib.hideRadial[​](https://overextended.github.io/docs/ox_lib/Modules/Interface/Client/radial#libhideradial) <a href="#libhideradial" id="libhideradial"></a>

Hides the radial menu if one is open.

```lua
lib.hideRadial()
```

#### lib.disableRadial[​](https://overextended.github.io/docs/ox_lib/Modules/Interface/Client/radial#libdisableradial) <a href="#libdisableradial" id="libdisableradial"></a>

Disallow players from opening the radial menu.

```lua
lib.disableRadial(state)
```

* state: `boolean`
  * Whether or not radial menu should be disabled

#### Usage Example[​](https://overextended.github.io/docs/ox_lib/Modules/Interface/Client/radial#usage-example) <a href="#usage-example" id="usage-example"></a>

\
Here's a use case example with some global options and an option utilising the lib's points system.

```lua
exports('myMenuHandler', function(menu, item)
    print(menu, item)

    if menu == 'police_menu' and item == 1 then
        print('Handcuffs')
    end
end)

lib.registerRadial({
  id = 'police_menu',
  items = {
    {
      label = 'Handcuff',
      icon = 'handcuffs',
      onSelect = 'myMenuHandler'
    },
    {
      label = 'Frisk',
      icon = 'hand'
    },
    {
      label = 'Fingerprint',
      icon = 'fingerprint'
    },
    {
      label = 'Jail',
      icon = 'bus'
    },
    {
      label = 'Search',
      icon = 'magnifying-glass',
      onSelect = function()
        print('Search')
      end
    }
  }
})

lib.addRadialItem({
  {
    id = 'police',
    label = 'Police',
    icon = 'shield-halved',
    menu = 'police_menu'
  },
  {
    id = 'business_stuff',
    label = 'Business',
    icon = 'briefcase',
    onSelect = function()
      print("Business")
    end
  }
})

local coords = GetEntityCoords(cache.ped)
local point = lib.points.new(coords, 5)

function point:onEnter()
  lib.addRadialItem({
    id = 'garage_access',
    icon = 'warehouse',
    label = 'Garage',
    onSelect = function()
      print('Garage')
    end
  })
end

function point:onExit()
  lib.removeRadialItem('garage_access')
end
```

<div><figure><img src="https://i.imgur.com/4eYU94s.png" alt=""><figcaption></figcaption></figure> <figure><img src="https://i.imgur.com/Czw7mLF.png" alt=""><figcaption></figcaption></figure></div>


---

# 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://max-workx.gitbook.io/maxworkx-private-fivem-docs/library/overextended/client-sided/ui/radial-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.
