Skip to content

IconifyIconName type

IconifyIconName type is used in Iconify Utils to handle icon names.

You can find this type in src/icon/name.ts of Iconify Utils source code.

IconifyIconName is a simple object with the following properties, all properties are mandatory:

  • provider, string. API provider. For public Iconify API value is an empty string "".
  • prefix, string. Icon set prefix.
  • name, string. Icon name.

Validation

All parts of icon name must match the following regular expression: /^[a-z0-9]+(-[a-z0-9]+)*$/.

The only exception is provider, which can be empty.

Expression for validation can be imported from Iconify Utils:

example.ts
tsimport { matchIconName } from '@iconify/utils';

const prefix = 'test-prefix';
if (prefix.match(matchIconName)) {
   // Prefix is valid
}

Released under the Apache 2.0 License.