# Display a notification

# Prerequisites

You must have a menu installed on your project (or you must create it yourself) To install default menu:

  1. npm install @rpgjs/default-gui
  2. In src/modules/index.ts file, add:
import defaultGui from '@rpgjs/default-gui' 

export default [
    defaultGui
]

# Use Notification

You have two ways to display a notification:

# Client Side

Use RpgGui:

import { RpgGui, PrebuiltGui } from '@rpgjs/client'

RpgGui.display(PrebuiltGui.Notification, {
    message: 'You have unlocked the secret passage',
    time: 2000,
    icon: 'icon_id',
    sound: 'sound_id'
})

RpgGui API

# Server Side

Use player.showNotification():

player.showNotification('You have unlocked the secret passage', {
    time: 2000,
    icon: 'icon_id',
    sound: 'sound_id'
})

player.showNotification()

# Custom Notification UI

Go to src/config/theme.scss file and add notification SCSS variables

Example:

$notification-background-color: rgba(0, 0, 0, 0.7);
$notification-font-color: white;
$notification-font-family: 'lato';