This tutorial is a work in progress.

This is a Javascript widget bundled by default with the XWiki platform.


The XWiki notification widget is a general purpose notification JavaScript class, displaying a simple message for the user, at the bottom of the screen.

  • Several default aspects: plain, info, warning, error, inprogress, done.
  • Stacking of multiple notifications on the screen.
  • Possibility to replace a notification with another one, preserving the position.
  • Automatic hide after a configurable period of time.
  • Configurable icon, background and text color.

To display a notification, it suffices to create a new XWiki.widgets.Notification object. Constructor parameters:

textThe notification textno
typeThe notification type, one of plain, info, warning, error, inprogress, done. If an unknown or no type is passed, plain is used by default.yes
optionsAdditional configuration; supported options:
  • timeout: number of seconds to keep the notification on the screen. Use 0 or false to keep it until manually removed.
  • inactive: don't show the notification when the object is created, manually call show later>   
  • icon: a custom image to use
  • color: a custom color for the text
  • backgroundColor: a custom color for the background
  • onHide: a custom function to call when the notification disappears

Default parameters for the predefined notification types:

Notification TypeParameter Values
  • timeout: 5
  • icon: none
  • color: black
  • background: #EEE
  • timeout: 5
  • icon: information
  • color: #28C
  • background: #DDF
  • timeout: 5
  • icon: /!\
  • color: 000
  • background: #FFD
  • timeout: 10
  • icon: error
  • color: #900
  • background: #EDD
  • timeout: false
  • icon: spinning
  • color: #268
  • background: #EEE
  • timeout: 2
  • icon: (v)
  • color: #090
  • background: #EFD



To see the notification in action just click here.

Here is the example code of the XWiki widget which displays the inprogress notification above:

To see the notification in action just click <a href="#Example" onclick="new XWiki.widgets.Notification('This tutorial is a work in progress.', 'warning');">here</a>.


Check out the Javascript code:

Check out the CSS code:

Created by Vincent Massol on 2017/09/04

Get Connected