IconSet

external class IconSet

Editable icon set.

An icon set contains icons, aliases, variations, metadata, characters and categories. Use class methods to modify entries and categories instead of writing to entries and categories directly.

Constructors

Link copied to clipboard
constructor(data: IconifyJSON)

Properties

Link copied to clipboard
var categories: dynamic

Native Set<IconCategory>. Use class methods to modify it.

Link copied to clipboard
var entries: dynamic

Entries keyed by icon name. Use class methods to modify them.

Link copied to clipboard

Icon set metadata.

Link copied to clipboard

Last modification time, as a Unix timestamp in seconds.

Link copied to clipboard

Icon set prefix.

Link copied to clipboard
var prefixes: dynamic

Theme prefixes: prefix without dash mapped to theme title.

Link copied to clipboard
var suffixes: dynamic

Theme suffixes: suffix without dash mapped to theme title.

Functions

Link copied to clipboard
fun chars(names: Array<String>? = definedExternally): dynamic

Get the character map (char to icon name), optionally limited to names.

Link copied to clipboard

Find icons that belong to themes.

Link copied to clipboard
fun count(): Int

Count icons, excluding aliases and hidden icons.

Link copied to clipboard
fun exists(name: String): Boolean

Check if an entry with this name exists.

Link copied to clipboard
fun export(validate: Boolean = definedExternally): IconifyJSON

Export the icon set as Iconify JSON.

Link copied to clipboard

Find a category by title, optionally creating it with add.

Link copied to clipboard
fun forEach(callback: (name: String, type: String) -> dynamic, types: Array<String>? = definedExternally): Promise<Unit>

Iterate over entries. The callback can return false to stop the loop.

Link copied to clipboard
fun forEachSync(callback: (name: String, type: String) -> dynamic, types: Array<String>? = definedExternally)

Synchronous version of forEach. The callback can return false to stop the loop.

Link copied to clipboard
fun fromSVG(name: String, svg: SVG): Boolean

Add or update an icon from an SVG, using its viewBox as dimensions.

Link copied to clipboard
fun getTree(names: Array<String>? = definedExternally): dynamic

Parent icon list for each icon, null when an alias cannot be resolved.

Link copied to clipboard
fun list(types: Array<String>? = definedExternally): Array<String>

List entry names of the requested types.

Link copied to clipboard
fun listCategory(category: dynamic): Array<String>?

List icons in a category.

Link copied to clipboard
fun load(data: IconifyJSON)

Load icon set data, replacing the current contents.

Link copied to clipboard
fun remove(name: String, removeDependencies: dynamic = definedExternally): Int

Remove an icon. When removeDependencies is a string, aliases are re-parented to it.

Link copied to clipboard
fun rename(oldName: String, newName: String): Boolean

Rename an entry and update aliases that reference it.

Link copied to clipboard
fun resolve(name: String, full: Boolean = definedExternally): ResolvedIconifyIcon?

Resolve an icon, alias or variation to icon data.

Link copied to clipboard
fun setAlias(name: String, parent: String): Boolean

Add or update an alias. Returns false when parent does not exist.

Link copied to clipboard

Add or update an icon from resolved icon data.

Link copied to clipboard
fun setItem(name: String, item: dynamic): Boolean

Add or update an entry. The item has a type of "icon", "alias" or "variation".

Link copied to clipboard
fun setVariation(name: String, parent: String, props: CommonIconProps): Boolean

Add or update a variation with props. Returns false when parent does not exist.

Link copied to clipboard
fun toggleCategory(iconName: String, category: String, add: Boolean): Boolean

Add or remove a category for an icon. Returns true if the category changed.

Link copied to clipboard
fun toggleCharacter(iconName: String, char: String, add: Boolean): Boolean

Add or remove a character for an icon. Returns true if the character map changed.

Link copied to clipboard
fun toHtml(name: String, customisations: IconifyIconCustomisations? = definedExternally): String?

Generate an SVG string for an icon.

Link copied to clipboard
fun toSVG(name: String): SVG?

Get an SVG instance for an icon, or null if it cannot be resolved.

Link copied to clipboard
fun updateLastModified(value: Double = definedExternally)

Update the last modification time. Without value, uses the current time.