NUI allows you to create custom HTML/CSS/JavaScript interfaces.
ui_page 'html/index.html'
files {
'html/index.html',
'html/style.css',
'html/script.js'
}<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div id="app"></div>
<script src="script.js"></script>
</body>
</html>-- Send data to NUI
SendNUIMessage({
type = 'showMenu',
data = menuData
})// Send data from NUI
fetch(`https://${GetParentResourceName()}/callback`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
type: 'buttonClick',
data: buttonData,
}),
})RegisterNUICallback('callback', function(data, cb)
print('Received from NUI:', data)
cb('ok')
end)For React applications:
html/ folderfxmanifest.luaNUI automatically handles CORS. No additional configuration needed.