Skip to content

Support custom class for icon #2195

@enodr

Description

@enodr
  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

The class name prefix is currently hardcoded for the icon type. Being able to pass a custom class prefix would allow to use webfonts like @mdi/font or fontawesome, etc.

What does the proposed API look like?

Current code is in icon/index.js is:

const classString = classNames({
[`anticon`]: true,
[`anticon-${type}`]: !!type,
});

In order to have compatibility with all components using icons (button, etc) a simple synthax could be used like:
<icon type="custom mdi mdi-earth"> and in the code if type.startsWith('custom ') then use the provided custom type as classNames.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions