NSS Docs
DiscordStoreHomepage
nss_libs
nss_libs
  • README
  • Changelog
  • UI components
    • NssUiApi basics
    • NssAudio
    • NssButton
    • NssClient
    • NssConfirm
    • NssHelper
    • NssLoadingIndicator
    • NssModal
    • NssPadLock
    • NssResponsive
    • NssSimpleTextEditor
    • NssSvgReplacer
    • NssTextBox
    • NssTip
  • Client/server modules
    • AttachProp
    • Blip
    • Character
      • Client Character
      • Server Character
    • Chunk
    • ClientEvent
    • ConfigValidator
    • Database
    • DatabaseUpdater
    • DependencyAutoRestart
    • Discord
    • EntityInRange
    • Helper
      • Client Helper
      • Server Helper
      • Shared Helper
    • Inventory
    • Keyboard
    • Notify
    • Npc
    • ParticleFxPlayer
    • PointInRange
    • Prompts
    • ServerEvent
    • VersionCheck
Powered by GitBook
On this page
  • How to use
  • ES6 module import
  • Create confirm dialog
  • Create alert dialog

Was this helpful?

  1. UI components

NssConfirm

PreviousNssClientNextNssHelper

Last updated 1 year ago

Was this helpful?

This component provide a simple confirm dialog with a title, a message and two buttons. Optionally you can use it as alert dialog with only one button.

How to use

ES6 module import

For NssUiApi usage, please see the of the nss_libs/ui folder.

Alternative example of direct ES6 module import:

import {NssConfirm} from "nui://nss_libs/ui/NssConfirm/NssConfirm.js";

Create confirm dialog

import {NssConfirm} from "nui://nss_libs/ui/NssConfirm/NssConfirm.js";

NssConfirm.confirm('Confirm message', 'Confirm', 'Cancel')
    .then(() => {
        // Answer was "Confirm", do your stuff here...
    })
    .catch(() => {
        // Answer was "Cancel", do your stuff here...
    });

This dialog has a fourth argument danger which is set to true a specific version of the dialog is shown.

Create alert dialog

import {NssConfirm} from "nui://nss_libs/ui/NssConfirm/NssConfirm.js";

NssConfirm.alert('Alert Messege', 'Confirm')
    .then(() => {
        // Answer was "Confirm", do your stuff here...
    });

This dialog has a fourth argument danger which is set to true a specific version of the dialog is shown.

README.md