Documentation

BX.UI.Icons.Generator.FileIcon

This extension was designed for generating icon files in .SVG format with specifying any extensions.

Class has two methods for returning an SVG icon:

  • generate() returns Dom element for SVG
  • generateURI() Returns image source, encoded into URL to be used as background image.

Such icon can be customized, but all parameters are optional, which means that upon calling without any parameters you will get a 'blank' icon:

let myIcon = new BX.UI.Icons.Generator.FileIcon();

Parameters

There are only 4 parameters, allowing to customize the icon, as follows:

name {string}. This option indicates the extension. It's recommended to use no more than 5 symbols. This class has presets: for example, if you indicate RAR, icon will be generated according to parameters, defined by our in-house designer.

color {string} defines label color for signature. Without indicated 'name', color won't work, because there is nothing to be coloured. Also, this option re-defines the value from preset.

fileType - this option sets the file type. There are 3 file types in total

BX.UI.Icons.Generator.FileType.ARCHIVE
BX.UI.Icons.Generator.FileType.MEDIA
BX.UI.Icons.Generator.FileType.PICTURE

This option also re-defines the value from preset, if available.

size {number} indicates the icon width in px. If option is not specified, icon occupies 100% of available width.


© «Bitrix24», 2001-2024
Up