Use Icon Theme From JavaScript

Last modified by Marius Dumitru Florea on 2026/03/24 13:59

We simplified the usage of icons from the current Icon Theme from JavaScript code:

// 1. Declare the icons you want to load:
define('my-module-icons', {
  icons: ['cross', ...]
});

// 2. Load the icons.
define('my-module', [
  'xwiki-icon!my-module-icons',
], function(icons) {
  // 3. Display the icon.
  document.querySelector('.my-icon-wrapper').append(icons.cross.render());
});

See the Icon Theme Application documentation for more information.

Get Connected