# Radial Menu

> Reference for Radial Menu in sky_jobs_base.

[All client exports](/docs/base/jobs-base/client-exports)

## Radial Menu

When `Config.JobRadial.targetContext.enabled` is enabled, the player target tracker and its marker remain active for the entire time the radial menu is open. This is independent of whether the currently visible actions require a player target.

### `openRadialMenu()`

- **Purpose**: Opens the job radial menu as if the player pressed the configured hotkey.

```lua
exports["sky_jobs_base"]:openRadialMenu()
```

### `registerRadialProvider(options)`

- **Purpose**: Registers the calling client resource as a dynamic radial action provider.
- **Arguments**:

  - `options.jobKeys` (`string | string[]?`) - limits the provider to exact job keys.
  - `options.jobGroups` (`string | string[]?`) - limits the provider to job groups such as `police` or `crime`.
- **Returns**: `boolean`.

The provider resource must expose `getRadialActions`, `triggerRadialMenuAction`, and optionally `canInteractRadialMenuAction`. Prefer this self-registration flow over adding the resource to `Config.JobRadial.providers`; the config list is intended for providers that cannot register themselves. A live self-registration and its job filters take precedence over a legacy config entry for the same resource.

An action may use `menu = { id, icon?, label?, description? }` to join a submenu. Actions with the same menu ID are grouped together, while a submenu containing only one currently available action is flattened automatically. Actions may also use `oxTarget = { types, bones?, distance?, boneRadius?, netId? }`, `radialTarget = true`, and `targetValidate = true` to receive and validate the live entity context.

When an action already displayed its own feedback or intentionally cancelled without a notification, its handler can return `false, { silent = true }`.

```lua
exports["sky_jobs_base"]:registerRadialProvider({
    jobGroups = { "crime" }
})
```

### `getRadialActions()`

- **Purpose**: Returns all available radial menu actions with their metadata.
- **Returns**: `RadialAction[]` — array of action objects with `id`, `label`, `icon`, `disabled`, and more.

```lua
local actions = exports["sky_jobs_base"]:getRadialActions()

for _, action in ipairs(actions) do
    print(action.id, action.label, action.disabled)
end
```

### `getRadialAction(actionId)`

- **Purpose**: Fetches a single radial action by its ID.
- **Arguments**:

  - `actionId` (`string`) — the action identifier.
- **Returns**: `table | nil` — the action object, or `nil` if not found.

```lua
local action = exports["sky_jobs_base"]:getRadialAction("stretcher_carry")
```

### `isRadialMenuActionAvailable(actionId)`

- **Purpose**: Checks if a radial action exists and is currently enabled.
- **Arguments**:

  - `actionId` (`string`)
- **Returns**: `boolean` — `true` when the action exists and is not disabled.

```lua
if exports["sky_jobs_base"]:isRadialMenuActionAvailable("treat_patient") then
    -- Action is available
end
```

### `triggerRadialMenuAction(actionId, context?)`

- **Purpose**: Executes a radial action handler without opening the UI.
- **Arguments**:

  - `actionId` (`string`)
  - `context` (`table?`) - optional selected entity, network ID, distance, and target information forwarded to the action provider.
- **Returns**:

  - `boolean` — `true` on success, `false` on failure.
  - `table?` — on failure, a table with `key` (locale key) and `fallback` (error message).

```lua
local success, err = exports["sky_jobs_base"]:triggerRadialMenuAction("treat_patient")

if not success then
    print("Failed:", err.fallback)
end
```

### Built-in Actions

These actions are registered by `sky_jobs_base` itself. Job scripts (like `sky_ambulancejob`) add their own actions on top.

<table>
<thead>
  <tr>
    <th>
      Action ID
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        tablet
      </code>
    </td>
    
    <td>
      Opens the tablet interface.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        remove_trunk_prop
      </code>
    </td>
    
    <td>
      Removes a nearby placed trunk prop.
    </td>
  </tr>
</tbody>
</table>

<br />
