Action Buttons

Action buttons are custom buttons that appear in the inventory UI toolbar. Unlike Context Actions (which appear when right-clicking an item), action buttons are always visible in the inventory header and can trigger any custom logic.

Action buttons screenshot

Action buttons 2nd screenshot

When to use Action Buttons

Use action buttons when you need:

  • A button always visible in the inventory (not item-specific)

  • Quick access to features like "Police Menu", "Garage", "Crafting", etc.

  • Job-specific or role-specific actions

Basic Usage

Registering a button

exports['jaksam_inventory']:registerActionButton(
    'my_button',           -- Unique ID
    'bi-star-fill',        -- Bootstrap Icons class
    'My Tooltip',          -- Tooltip on hover (or nil)
    function()             -- Click callback
        print('Clicked!')
    end,
    true                   -- Visible (default: true)
)

Removing a button

Showing/Hiding without removing

Practical Examples

Job-specific button (Police)

Register the button once when the resource starts, then show/hide based on job:

Button that opens a stash

Crafting menu button

Multiple buttons for different jobs

Important Notes

  1. Unique IDs: Each button must have a unique ID. Registering with the same ID will overwrite the previous button

  2. Persistence: Buttons survive inventory open/close but are lost on resource restart. Re-register them when your resource starts

  3. Performance: Don't register/unregister buttons repeatedly. Register once, then use show/hide to toggle visibility

Last updated

Was this helpful?