Frameworks & scripts

NUI

Also called New UI, FiveM HTML UI

FiveM's system for drawing HTML, CSS and JavaScript interfaces in-game, used for phones, HUDs, inventories, menus and loading screens.

NUI is the in-game browser layer FiveM uses for custom interfaces. A resource declares a page with ui_page in its fxmanifest, lists the HTML, CSS and JS under files, and the client renders that page over the game using an embedded Chromium.

Communication goes both ways. Lua sends data to the page with SendNUIMessage, and the page calls back into Lua by posting to a resource URL that is handled with RegisterNUICallback. SetNuiFocus gives the page keyboard and mouse input, and forgetting to release it is the classic bug that leaves players stuck with a cursor and no controls.

Most modern interfaces are built with a front-end framework and a build step, then shipped as static files. That is fine as long as the output is small. NUI pages are downloaded with the resource, so a phone that ships megabytes of unused fonts and images adds directly to join time and to onboarding drop-off.

Performance matters more than in a normal browser because NUI shares the frame budget with the game. Avoid heavy CSS effects, keep animation to transforms and opacity, and stop timers and listeners when the UI is hidden. Some CSS features that work in a desktop browser render poorly or not at all in the embedded version, so test in game rather than only in Chrome.

Loading screens are a special case of NUI, defined with loadscreen in the manifest, and they run before the player has spawned.

Related terms

Trying to get your server seen?

The live leaderboard shows what the numbers look like at the top of the list, and the upvote calculator turns a target server into a campaign size. The full glossary is here.