Skip to content

feat(radial): Allow open specific radial menu as root#812

Open
XCal-Dev wants to merge 3 commits into
overextended:mainfrom
XCal-Dev:main
Open

feat(radial): Allow open specific radial menu as root#812
XCal-Dev wants to merge 3 commits into
overextended:mainfrom
XCal-Dev:main

Conversation

@XCal-Dev

@XCal-Dev XCal-Dev commented Jul 10, 2026

Copy link
Copy Markdown

Description

I hope I wasn't blind and missed something obvious.

Adds lib.showRadialMenu(id), allowing a menu registered with lib.registerRadial to be opened directly as an independent root menu.

Previously, registered radial menus could only be reached by referencing them as a submenu from another radial item. This made context-specific radial menus depend on the global radial menu, even when they were intended to operate separately.

This allows resources to open their own registered radial menus without adding temporary items to, replacing, or otherwise modifying the global radial menu.

Example

lib.registerRadial({
    id = 'vehicle_actions',
    items = {
        {
            label = 'Toggle Engine',
            icon = 'power-off',
            onSelect = function()
                -- Toggle the vehicle engine.
            end
        },
        {
            label = 'More Options',
            icon = 'ellipsis',
            menu = 'vehicle_more_options'
        }
    }
})
lib.showRadialMenu('vehicle_actions')

Behaviour

A menu opened with lib.showRadialMenu:

  • Is displayed as a root menu without a back button.
  • Does not affect the items in the global radial menu.
  • Can open registered child menus normally.
  • Shows the back button inside child menus and returns to the directly opened root.
  • Transitions directly when called with a different registered root menu while one is already open.
  • Transitions to the global radial menu when the normal radial keybind is pressed.
  • Uses the existing radial focus, cursor, pause-menu, disabled-state, and control-blocking behaviour.

Implementation

A separate rootRadial reference is used to distinguish the active root from its child menus.

This allows the existing showRadial transition and history logic to be reused while determining whether the current registered menu should be rendered as a root or submenu.

Root state and menu history are reset when:

  • The radial menu is closed.
  • Another registered root is opened.
  • The user transitions back to the global radial menu.
  • The global radial menu is opened normally.

Compatibility

This does not change the existing lib.registerRadial, lib.addRadialItem, or global radial menu APIs.
I have tested on the following.

  1. latest release QBX with qbx_radialmenu with no issues or compatibility issues.
  2. latest release QBX with my own custom radialmenu with no issues or compatibility issues.
  3. All regular Radial functions work as intended, refreshRadial() still functions with lib.showRadialMenu()

XCal-Dev added a commit to XCal-Dev/overextended.github.io that referenced this pull request Jul 10, 2026
Updated code examples for showing a specific radial menu. Related pull request: overextended/ox_lib#812

Signed-off-by: URRP XC <122388423+XCal-Dev@users.noreply.github.com>
@XCal-Dev

Copy link
Copy Markdown
Author

Related Docs change
overextended/overextended.github.io#282

@thelindat

Copy link
Copy Markdown
Member

Please try to reduce code duplication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants