For the complete documentation index, see llms.txt. This page is also available as Markdown.

Getting Started

How to install and start using dirk-cfx-react in a FiveM resource

Installation

Install dirk-cfx-react in your resource's web/ folder:

pnpm add dirk-cfx-react

Wrap Your App

In your resource's root React component, wrap everything in DirkProvider:

import { DirkProvider } from "dirk-cfx-react";
import { AdminPanel } from "./components/Admin/main";

function App() {
  return (
    <DirkProvider>
      <AdminPanel />
    </DirkProvider>
  );
}

DirkProvider handles:

  • Mantine theme setup with dark mode and VH-based sizing

  • Fetching server settings (currency, colours, item image path, game type)

  • Font loading (Akrobat family)

  • Error boundary wrapping

  • NUI ready signal (NUI_READY callback)


Build Setup

Your resource's web/ folder should use Vite as the build tool. A typical Vite config:

Build command:

The output goes to web/build/ which is served by FiveM's NUI system.


Importing

Everything is exported from the top-level package:

You can also import from sub-paths if you prefer:

Last updated