grid-4Create Custom App

0R SmartPad | How To Create Custom App

Creating a Custom App

This guide walks you through creating a custom app that runs inside the 0r-smarttab tablet.


Step 1: Register the App

Open the admin panel in-game:

/tabadmin

Click "Add New App" and fill in the form:

Field
Description
Example

App Name

Display name on the tablet

Stock Market

App ID

Unique identifier (no spaces)

app-stocks

Description

Short description (optional)

Real-time stock tracker

Category

Dropdown: General, Job, Services, etc.

Services

Color

Pick a color for the icon background

(click a circle)

Icon Path

Path to icon image

/appicons/stocks.png

Iframe URL

Your app's NUI URL

https://cfx-nui-my-stocks/web/dist/index.html

Job Filter

Comma-separated jobs (empty = everyone)

police, ems

Click "Create App". The app appears on all tablets immediately.

Icon tip: Place your .png icon file in 0r-smarttab/web/dist/appicons/. Use a square image (128x128 recommended).


Step 2: Set Up the Resource

Download the 0r-customapp template from GitHub. This is a ready-to-use FiveM resource with React + TypeScript.

File Structure

fxmanifest.lua

Iframe URL Format

The URL you entered in the admin panel must point to your resource:

Replace my-custom-app with your resource folder name.


Step 3: Receive Tablet Context

When your app opens inside the tablet, it automatically receives context data via postMessage. Use the included hook:

Context Fields

Field
Type
Description

serial

string

Tablet serial number (unique per device)

appId

string

App action ID (e.g. app-stocks)

appFullId

string

Full app ID from apps.json

playerJob

string

Player's current job name

language

string

Tablet language code (en, tr, etc.)

config

object

Server config values


Step 4: Use Tablet Features

Custom apps can use tablet notifications and badges through Lua exports. No JavaScript needed for these — just call them from your client.lua or server.lua.

Send a Notification

Shows a notification banner on the tablet (with sound, peek when closed, notification history).

From client.lua:

From server.lua:

Set App Badge

Shows a red badge (number) on your app's icon on the home screen.

From client.lua:

From server.lua:


Step 5: Listen for Tablet Events (Optional)

Your app's JavaScript can listen for theme and visibility changes from the tablet:

Your app can also request to close itself:


Quick Reference

Lua Exports

Export
Side
Signature

SendNotification

Client

exports['0r-smarttab']:SendNotification(data)

SendNotification

Server

exports['0r-smarttab']:SendNotification(targetSrc, data)

SetAppBadge

Client

exports['0r-smarttab']:SetAppBadge(appId, count)

SetAppBadge

Server

exports['0r-smarttab']:SetAppBadge(targetSrc, appId, count)

OpenTabletWithApp

Client

exports['0r-smarttab']:OpenTabletWithApp(appId)

Iframe Messages (JS)

Message
Direction
Payload

0r-smarttab-context

Tablet → App

{ serial, appId, playerJob, language, config }

0r-smarttab-theme-change

Tablet → App

{ theme: 'dark' | 'light' }

0r-smarttab-visibility

Tablet → App

{ visible: boolean }

0r-smarttab-close

App → Tablet

(no payload)

Notification Data Fields

Field
Type
Required
Default

title

string

Yes

description

string

Yes

app

string

No

icon

string

No

duration

number

No

4000

Last updated