> For the complete documentation index, see [llms.txt](https://project-07.gitbook.io/project_07-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://project-07.gitbook.io/project_07-docs/scripts/project07-radialmenu-v2/exports.md).

# Exports

## Project07 Radial Menu — Exports Reference

All exports below are **client-side** (`client_scripts`) unless noted otherwise. Resource name used in examples: `Project07_RadialMenu` — replace with your actual folder/resource name if you renamed it.

These are the same functions available through the `lib.registerRadial` / `lib.addRadialItem` / etc API (see `bridge/ox_lib_radial_override.lua` for the ox\_lib-compatible wrapper) — the exports below are what that bridge actually calls under the hood, and what any other resource can call directly.

***

### AddRadialItem

Adds one item (or an array of items) to the root radial menu, or to a specific registered submenu.

```lua
exports['Project07_RadialMenu']:AddRadialItem(items, parentMenuId)
```

* **items**: `table` — a single item `{id, label, icon, ...}`, or an array of them
* **parentMenuId**: `string?` — if provided, adds to that registered submenu (see `RegisterRadial`) instead of the root menu

**Item fields**

* **id**: `string` — unique id, required
* **label**: `string` — text shown on the card
* **icon**: `string?` — FontAwesome 6 solid icon name, e.g. `"car-side"` (no `fa-` prefix)
* **menu**: `string?` — id of a registered submenu to open instead of firing an event
* **event**: `string?` — client event to trigger on select
* **serverEvent**: `string?` — server event to trigger on select
* **command**: `string?` — command to execute on select
* **args**: `any?` — passed through to `event` / `serverEvent` / `command`
* **keepOpen**: `boolean?` — if true, the menu stays open after this item fires
* **grid**: `table?` — `{ label, options = {{id, icon, label, active}, ...} }`, shows a small side toggle-panel (like vehicle extras) instead of navigating

**Example usage**

```lua
RegisterCommand('addmyradialitem', function()
    exports['Project07_RadialMenu']:AddRadialItem({
        id    = 'give_id_card',
        label = 'Show ID',
        icon  = 'id-card',
        event = 'myscript:client:showID',
    })
end)
```

***

### RemoveRadialItem

Removes an item from the root radial menu, or from a specific submenu.

```lua
exports['Project07_RadialMenu']:RemoveRadialItem(id, parentMenuId)
```

* **id**: `string` — the item's id
* **parentMenuId**: `string?` — if provided, removes from that submenu instead of the root menu

**Example usage**

```lua
exports['Project07_RadialMenu']:RemoveRadialItem('give_id_card')
```

***

### RegisterRadial

Registers a submenu (a named page of items) that other items can navigate into via their `menu` field.

```lua
exports['Project07_RadialMenu']:RegisterRadial(data)
```

* **data**: `table`
  * **id**: `string` — unique submenu id, required
  * **label**: `string?` — submenu title
  * **items**: `table[]` — array of items (same shape as `AddRadialItem`)

**Example usage**

```lua
exports['Project07_RadialMenu']:RegisterRadial({
    id = 'myscript_submenu',
    label = 'My Actions',
    items = {
        { id='action_a', label='Action A', icon='star', event='myscript:client:actionA' },
        { id='action_b', label='Action B', icon='bolt', event='myscript:client:actionB' },
    },
})

exports['Project07_RadialMenu']:AddRadialItem({
    id    = 'open_my_submenu',
    label = 'My Actions',
    icon  = 'list',
    menu  = 'myscript_submenu',
})
```

***

### ClearRadialItems

Removes every item from the root radial menu (registered submenus are kept).

```lua
exports['Project07_RadialMenu']:ClearRadialItems()
```

**Example usage**

```lua
exports['Project07_RadialMenu']:ClearRadialItems()
```

***

### DisableRadial

Prevents (or re-allows) the player from opening the radial menu at all — closes it immediately if it's currently open and `state` is `true`.

```lua
exports['Project07_RadialMenu']:DisableRadial(state)
```

* **state**: `boolean` — `true` to disable, `false` to re-enable

**Example usage**

```lua
-- lock the menu during a cutscene
exports['Project07_RadialMenu']:DisableRadial(true)
Wait(5000)
exports['Project07_RadialMenu']:DisableRadial(false)
```

***

### HideRadial

Closes the radial menu if it's currently open. Safe to call even if it's already closed.

```lua
exports['Project07_RadialMenu']:HideRadial()
```

**Example usage**

```lua
exports['Project07_RadialMenu']:HideRadial()
```

***

### OpenRadial

Opens the root radial menu (same as pressing the configured keybind).

```lua
exports['Project07_RadialMenu']:OpenRadial()
```

**Example usage**

```lua
RegisterCommand('forceopenradial', function()
    exports['Project07_RadialMenu']:OpenRadial()
end)
```

***

### GetCurrentRadialId

Returns the id of the currently-open submenu, or `nil` if the root menu (or nothing) is open.

```lua
exports['Project07_RadialMenu']:GetCurrentRadialId()
```

> **Note**: this resource's navigation stack lives entirely in the NUI (React) layer for smooth submenu transitions, so this always returns `nil` — it exists only for API compatibility with scripts written against ox\_lib's radial menu.

**Example usage**

```lua
local currentId = exports['Project07_RadialMenu']:GetCurrentRadialId()
```

***

### Legacy aliases

Kept for older third-party scripts that used these names before this resource adopted the ox\_lib-style naming above. Behave identically to their counterparts.

```lua
exports['Project07_RadialMenu']:AddOption(items, parentMenuId)      -- = AddRadialItem
exports['Project07_RadialMenu']:RemoveOption(id, parentMenuId)      -- = RemoveRadialItem
```
