New guide on how to setup a new NUI on FiveM, the only thing required is a running FiveM server. Let’s get started!


  • Running FiveM server.


  1. The first thing you want to do is create a new folder inside the resource’s folder. You can name it whatever you want.
  2. Now open the folder and create a file named: fxmanifest.lua and a folder named: client/
  3. Inside the client/ folder create another folder named: nui/, and a file: main.lua
  4. Inside the the nui/ folder create an index.html and if you like a .js and .css file


fx_version 'cerulean'
game 'gta5'

author 'devhideout'
version '1.0.0'

ui_page 'client/nui/index.html' -- Path to the main .html file
-- ui_page '' -- Url the page

-- All files related to the html part: html, css, js
files {

-- Files needed to be loaded into the client
client_script {


local display = false

RegisterNUICallback("close", function(data)

function setDisplay(bool)
    display = bool
    SetNuiFocus(bool, bool)
        type = "display",
        status = bool,

RegisterCommand("customNuiDisplay", function(source, args, rawCommand)
end, true)

This code will show the nui when the command /nui get issued in the chat. When the nui send a callback named close it will make the nui disappear.


<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- If you want to use an external css file
    <link href="style.css" rel="stylesheet"></link>-->
    <script src="nui://game/ui/jquery.js" type="text/javascript"></script>
    <!-- If you want to use an external js file
    <script src="app.js" type="text/javascript"></script>-->
    <div id="root" style="height:400px; width:400px; background-color:red;">
        <!-- <button id="closeui" style="height:50px; width:50px; background-color:black; color: white">X</button> -->
        <p>It works! Hello there</p>
        $(function() {

        let url = 'https://nui-example/';

        // Controls whether the NUI needs to be shown or not 
        function display(bool) {
            if (bool) {


        // Listener for all the NUIMessages that comes from the client/main.lua file
        window.addEventListener('message', function(event) {
            if ( === "display") return display(

        // If the Escape key is pressed the NUI closes
        document.onkeyup = data => {
            if (data.key === "Escape") return $.post(`${url}close`, JSON.stringify({}));

        // Closes the NUI when the button is pressed
        //$('#closeui').click(e => {
             //return $.post(`${url}close`, JSON.stringify({}));



Make sure to replace the resource name in the JS part, otherwise the callbacks won’t work.


Its important that jQuery is loaded with fivem so you won’t need to download it or use a CDN just use:

<script src="nui://game/ui/jquery.js" type="text/javascript"></script>

This is the basic for the creation of a NUI on FiveM, if you want you can download the resource from here, or you can copy and paste it. Make sure to stay toned for other guides.