Skip to main content
Mythic Framework uses React for all user interfaces, rendered inside FiveM’s NUI layer (a Chromium-based browser). Client Lua scripts communicate with React UIs through NUI messages and callbacks.

UI Architecture

Technology Stack

Mythic resources use two UI stacks depending on age:

Legacy UIs

React 17 + Redux + ThunkUsed by: HUD, Inventory, MDT, Laptop, most existing resources

Modern UIs

React 18 + Zustand + TypeScriptUsed by: New Phone UI (ui-new/), newer resources
Common across both:
  • Material-UI v5 — Component library
  • Emotion — CSS-in-JS styling
  • Webpack 5 — Module bundler

UI Resources

mythic-hud

Health, armor, status bars, vehicle info, minimap, notifications

mythic-phone

Smartphone with contacts, messages, calls, email, camera, apps

mythic-inventory

Drag-and-drop inventory, tooltips, crafting, shops

mythic-mdt

Police MDT — warrants, person/vehicle lookup, dispatch, reports

mythic-laptop

Laptop interface with email, documents, browser

mythic-characters

Character creation, appearance customization, selection

mythic-menu

Context menus with nested submenus and keyboard navigation

mythic-chat

In-game chat with commands

Client-UI Communication

Lua to React (SendNUIMessage)

React side — listening for messages:

React to Lua (NUI Callbacks)

Lua side — handling NUI callbacks:

Communication Flow

Custom Hooks

useNuiEvent

Simplify NUI message handling:

State Management

Redux (Legacy UIs)

Zustand (Modern UIs)

Best Practices

Always manage NUI focus properly in Lua:
Always handle ESC to close UI:
Don’t render hidden UIs — return null:
Optimize React rendering:

Building UIs

Built UI files go into dist/ which is referenced by ui_page in fxmanifest.lua. Always run npm run build before testing in-game.

Next Steps

Resource Structure

How UI fits into resource organization

Component System

Server/client components that power UIs

Event System

Events that trigger UI updates

HUD API

HUD component API reference