Docs/Dirk CFX React/Components

Components

Dirk CFX React

All components are exported from dirk-cfx-react and use Mantine + Framer Motion internally. They follow a dark-theme, VH-based sizing convention.


Admin Components

AdminPageTitle

Section header for admin panel pages. Renders a Lucide icon with a localized uppercase title.

tsx
import { AdminPageTitle } from "dirk-cfx-react";
import { Fish } from "lucide-react";

<AdminPageTitle title="FishSettings" icon={Fish} color="#4ade80" />
PropTypeDescription
titlestringLocale key for the title text
iconComponentType<LucideProps>Lucide icon component
colorstringIcon colour

AsyncSaveButton

Animated save button with idle / pending / success / error states. Shows a spinner while saving, a check on success, and an X on failure.

tsx
import { AsyncSaveButton } from "dirk-cfx-react";

<AsyncSaveButton
  onSave={async () => {
    const result = await updateSettings(changes);
    return result;
  }}
  color="#4ade80"
  label="Save Changes"
/>
PropTypeDescription
onSave() => Promise<any>Async save handler — return { success: false } to show error state
colorstringTheme colour for the button
labelstringButton label (default: "Save Changes")
styleCSSPropertiesOptional inline styles

Input Components

InputContainer

Styled wrapper for form fields. Provides a title, description, error display, and consistent dark-theme styling.

tsx
import { InputContainer } from "dirk-cfx-react";

<InputContainer
  title="Fish Name"
  description="The item name used in inventory"
  error={errors?.name}
>
  <TextInput value={name} onChange={...} />
</InputContainer>
PropTypeDescription
titlestringField label
descriptionstringHelp text shown below the label
errorstringValidation error message
childrenReactNodeThe input element(s)
wstring | numberWidth (default: "100%")
flexnumber | stringFlex value
bgstringBackground colour override
pstring | numberPadding (default: "sm")
rightSectionReactNodeContent rendered to the right of the title
variantsVariantsFramer Motion variants

SelectItem

Item selector with image previews. Pulls items from the useItems store (populated by GET_ITEMS NUI callback).

tsx
import { SelectItem } from "dirk-cfx-react";

<SelectItem
  label="RewardItem"
  value={selectedItem}
  onChange={(v) => setValue("reward.item", v)}
  excludeItemNames={["weapon_pistol"]}
/>
PropTypeDescription
labelstringLocale key for the select label
valuestringCurrently selected item name
onChange(value: string) => voidChange handler
excludeItemNamesstring[]Item names to exclude from the list

FiveMKeyBindInput

Compound component for configuring FiveM keybinds. Supports keyboard, mouse, gamepad, joystick, and touchpad input mappers.

tsx
import { FiveMKeyBindInput, type FiveMControls } from "dirk-cfx-react";

const [controls, setControls] = useState<FiveMControls>({
  _type: "KEYBOARD",
  _key: "E",
});

<FiveMKeyBindInput value={controls} onChange={setControls}>
  <FiveMKeyBindInput.Category label="Input Type" />
  <FiveMKeyBindInput.Key label="Key" />
</FiveMKeyBindInput>

Sub-components:

ComponentDescription
FiveMKeyBindInput (Root)Context provider — requires value and onChange
FiveMKeyBindInput.CategoryDropdown to select the input mapper (keyboard, mouse, pad, etc.)
FiveMKeyBindInput.KeyDropdown for the specific key — auto-filters to valid keys for the selected category

Modals

General-purpose modal with dark theme, header with icon/badge, close button, and description area.

tsx
import { Modal } from "dirk-cfx-react";

<Modal
  title="Edit Fish"
  icon={Fish}
  iconColor="#4ade80"
  description="Configure this fish species"
  onClose={() => setOpen(false)}
>
  {/* content */}
</Modal>
PropTypeDescription
titlestringModal title
iconReact.ElementTypeHeader icon
iconColorstringIcon colour
descriptionstringDescription text below header
badge{ label, color }Optional badge next to the title
onClose() => voidClose handler
widthstringModal width (default: "52vh")
maxHeightstringMax height (default: "85vh")
zIndexnumberZ-index (default: 100)
clickOutsidebooleanClose on backdrop click (default: true)

ConfirmModal

Destructive action confirmation with optional type-to-confirm.

tsx
import { ConfirmModal } from "dirk-cfx-react";

<ConfirmModal
  title="Delete Fish"
  description="This will permanently remove this fish species."
  confirmLabel="Delete"
  confirmText="bass"
  onConfirm={() => removeFish("bass")}
  onClose={() => setOpen(false)}
/>
PropTypeDescription
titlestringWarning title
descriptionstringWarning message
confirmLabelstringConfirm button text (default: "Delete")
confirmTextstringIf set, user must type this exact string to enable confirm
onConfirm() => voidConfirm handler
onClose() => voidCancel/close handler

Display Components

LevelBanner / LevelPanel

XP and level display components. Use with createSkill to define your levelling curve.

Counter

Animated number counter with configurable duration and format.

BorderedIcon

Icon with a bordered circular background, commonly used in lists.

FloatingParticles

Decorative animated particle effect for backgrounds.

InfoBox

Styled information box with icon and text.

Tab-style navigation bar with animated active indicator.

Title

Styled page title with gradient underline.

SegmentedControl / SegmentedProgress

Animated segmented controls and progress indicators.

Was this page helpful?
This page was last updated on 15 March 2026
DIRKSCRIPTS
All you need for your FiveM server.10% off your first order

Unsubscribe any time.

Copyright © 2026 DirkScripts. Not affiliated with or endorsed by Rockstar North or Take-Two Interactive.