RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

server/commands - Camera & Input Commandsge_utils - Game Engine Utility Functionsmain.lua - GE Lua Entry Point & Game Loopmap.lua - Navigation Graph (AI Road Map)screenshot.lua - Screenshot Systemserver/server - Level Loading & Game ServerserverConnection - Client-Server Connection Manager`setSpawnpoint` - Default Spawn Point Persistence`simTimeAuthority` - Simulation Time & Bullet Time Control`spawn` - Vehicle Spawning & Safe Placement`suspensionFrequencyTester` - Suspension Natural Frequency Analysis
ui/ambientSound - Ambient Sound Stream PlayerUI Apps ManagerUI AudioBindings LegendCamera Distance AppConsole (consoleNG)Credits MusicExternal App (WebSocket UI Server)Fade ScreenGame BlurGameplay App ContainersGrid SelectorLivery EditorMessages DebuggerMessages/Tasks App ContainersMission InfoPolice InfoTop BarUI ModsUI Navigation / MapVehicle Paint EditorVehicle Vicinity AppUI Visibility

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE Extensionsui

Top Bar

Manages the top navigation bar entries, visibility, and active item state.

Manages the top navigation bar entries, visibility, and active item state.


Overview

ui_topBar controls the top navigation bar in the game UI. It manages a list of entries (defined in ui_topBar_config), handles item selection/navigation, and synchronises state with the CEF UI via guihooks.

Extension path: lua/ge/extensions/ui/topBar.lua Dependencies: ui_topBar_config


Exports (M)

FunctionSignatureDescription
show()Shows the top bar.
hide()Hides the top bar.
selectItem(item)Selects an entry by id or table, triggers its action.
selectPreviousItem(loop)Navigates to the previous visible item.
selectNextItem(loop)Navigates to the next visible item.
setActiveItem(item)Sets the active item without triggering action.
addEntry(key, entry)Adds a new top bar entry.
removeEntry(key)Removes an entry by key.
updateEntry(key, entry)Updates an existing entry or adds it.
updateEntries(entries)Replaces all entries.
getEntry(key) → entryReturns a single entry.
getEntries() → tableReturns all entries.
requestData()Sends all bar state + game state to UI.
requestEntries()Sends entries to UI.
requestGameState()Sends game state flags to UI.
updateVisibleItems()Recalculates which items are visible.
updateActiveItem()Matches active item to current UI state.
onExtensionLoaded()Hook - initializes top bar entries and requests game state.
onGameStateUpdate(state)Hook - updates top bar when game state changes.
onAnyMissionChanged(state, mission)Hook - refreshes top bar on mission changes.
onUiChangedState(state)Hook - responds to UI state changes.
onUIStateTriggered(state, opened, stack)Hook - responds to UI state triggers.

State (M.state)

FieldTypeDescription
visibleboolWhether the bar is shown.
visibleItemsstring[]IDs of currently visible entries.
activeItemstringID of the currently active entry.
currentUIStatestringCurrent UI angular state.

Data Fields

FieldDescription
M.dependencies{'ui_topBar_config'} - top bar configuration module.

Internals

Visibility Filtering

updateVisibleItems() filters entries by:

  • Blacklisted states - item.blackListStates vs currentUIState
  • Hidden callback - item.isHidden() returns true
  • In-game only - item.onlyIngame vs getMissionFilename()

Entries are sorted by order and their IDs emitted via ui_topBar_visibleItemsChanged.

Active Item Matching

updateActiveItem() matches currentUIState against:

  1. Entry's targetState (exact match)
  2. Entry's substates (prefix match)

Game State

getGameState() returns flags: isInGame, isCareerActive, isGarageActive, isMissionActive, isScenarioActive, isScenarioUnrestricted.


How It Works

  1. On load, the extension sets manual unload mode.
  2. Entries come from ui_topBar_config.TopBarEntries.
  3. When the UI requests data, requestData merges entries + game state + bar state.
  4. selectItem finds the entry, sets it active, and calls its targetState change or action().
  5. Keyboard/gamepad navigation uses selectPreviousItem / selectNextItem.

Lua Examples

-- Select the bigmap entry
extensions.ui_topBar.selectItem("bigmap")

-- Hide the top bar
extensions.ui_topBar.hide()

-- Add a custom entry
extensions.ui_topBar.addEntry("myMod", {
  id = "myMod", label = "My Mod", icon = "star",
  targetState = "menu.mymod", order = 50
})

Hooks Triggered

HookWhen
ui_topBar_show / ui_topBar_hideBar shown/hidden
ui_topBar_activeItemChangedActive item changes
ui_topBar_visibleItemsChangedVisible items recalculated
ui_topBar_entryAdded/Removed/ChangedEntry mutations
ui_topBar_entriesChangedBulk entry update
ui_topBar_dataRequestedFull data requested
ui_topBar_gameStateChangedGame state sent

Additional Exports

The following exports are available but not yet documented in detail:

  • M.addEntry
  • M.getEntries
  • M.getEntry
  • M.hide
  • M.onAnyMissionChanged
  • M.onExtensionLoaded
  • M.onGameStateUpdate
  • M.onUIStateTriggered
  • M.onUiChangedState
  • M.removeEntry
  • M.requestData
  • M.requestEntries
  • M.requestGameState
  • M.selectItem
  • M.selectNextItem
  • M.selectPreviousItem
  • M.setActiveItem
  • M.show
  • M.updateActiveItem
  • M.updateEntries
  • M.updateEntry
  • M.updateVisibleItems

Police Info

Sends police pursuit data to the UI HUD every frame.

UI Mods

Discovers Vue mod components and notifies UI when mod files change.

On this page

OverviewExports (M)State (M.state)Data FieldsInternalsVisibility FilteringActive Item MatchingGame StateHow It WorksLua ExamplesHooks TriggeredAdditional Exports