Custom Apps
LB Phone allows you to add apps that either have a UI or simply trigger functions when opening the app. To add an app that triggers a function upon opening it, go to lb-phone/config/config.lua and add the app to the Config.CustomApps table, like this:
Custom apps using UI
If you want to use a custom UI for your app, you need to create a seperate script and provide the path of the HTML file and send it as ui.
The recommended way to create an app with UI is to create it using exports. We have template apps that you can use for reference.
If the user has dark mode enabled, data-theme will be set to dark. Otherwise, it will be set to light.
Adding the app
To add the app, use the AddCustomApp export.
Removing the app
To remove the app, use the RemoveCustomApp export.
Sending a message to the UI
To send a message to the UI, you need to use the SendCustomAppMessage export instead of using SendNUIMessage. You would listen for it the same way in the frontend.
Imported components & functions
When the app gets loaded on the phone, a few functions are imported into the globalThis object.
Components
The following components can be accessed via globalThis.components. You can view a TypeScript declaration file at lb-reactts/ui/src/components.d.ts.
createGameRender
Creates a game render, which renders the game to a canvas. This is used to create a camera in your app, and should be used with the camera exports.
uploadMedia
Uploads media and returns a promise with the URL.
saveToGallery
Saves a URL to the gallery and returns a promise with the ID
setColorPicker
setPopUp
setContextMenu
setContactSelector
setShareComponent
See the AirShare export for what data to send.
setEmojiPickerVisible