SamuelS
SamuelS

Reputation: 31

Is there any way of using custom icons in primereact tree?

is there any way of using custom icons in primereact tree? I've tried importing them in css file and using them like that but it did not work.

Here is a sample of json file with primereact icon usage.

"key": "0-0",
"label": "Work",
"data": "Work Folder",
"icon": "pi pi-fw pi-cog" 

Icon usage in css

.myIcon {
background-image: url('imgpath');
}

Here is a sample of json file with custom icon usage

"key": "0-0",
"label": "Work",
"data": "Work Folder",
"icon": "myIcon" 

Would really appreciate help with this one

EDIT: So I've managed to solve this problem by replacing background-image with content.

Css below:

.m-icon {
 content: url("../images/module.png");
}

Upvotes: 1

Views: 1017

Answers (1)

SamuelS
SamuelS

Reputation: 31

I've managed to solve this problem by replacing background-image with content.

Css below:

.m-icon {
 content: url("../images/module.png");
}

Upvotes: 2

Related Questions