Create Custom App

Guide and templates for creating custom apps.

We've created an ability to create fully custom apps for our laptop. You'll be able to send messages, trigger functions as you normally do it your fully customs resources. We also provide injected function to get data and information directly in your resource NUI.

Adding app

To add custom app directly from your resource, on server side you can use addCustomApp export which is referenced below in code example. Export reference.

server.lua
   CreateThread(function()
      while GetResourceState("fd_laptop") ~= "started" do
          Wait(500)
      end

      --
      local added, errorMessage = exports.fd_laptop:addCustomApp({
          id = "testing_app",
          name = "Testing App",
          isDefaultApp = true,
          needsUpdate = false,
          icon = 'question.svg',
          ui = ("https://cfx-nui-%s/web/index.html"):format(GetCurrentResourceName()),
          keepAlive = true,
          ignoreInternalLoading = true,
          windowActions = {
              isResizable = false,
              isMaximizable = false,
              isClosable = true,
              isMinimizable = true,
              isDraggable = false
          },
          windowDefaultStates = {
              isMaximized = true,
              isMinimized = false
          },
      })

      if not added then
          print("Could not add app:", errorMessage)
      end
  end)

Removing app

To add custom app directly from your resource, on server side you can use removeCustomApp export which is referenced below in code example. Export reference.

server.lua
  local removed, errorMessage = exports.fd_laptop:removeCustomApp("testing_app")

  if not removed then
      print("Could not remove app:", errorMessage)
  end

Templates

For better understanding, we've prepared few templates. Please take a look at VueJS and React simple templates can be found in our repository here.