How to apply different style for tree component in individual item

Hi Team,

I am using the Tree component in one of my applications. I need to apply different fonts for parent items and their child items. However, the Tree component currently supports only one common style, which applies to all items.

Thank you for your response. This is great. I would like to assign different icons to individual parent and child items—would it be possible to customize the icons accordingly?

You should be able to define the icons for each item in the tree structure. You have to specify it per item when building the items property.

Each item in items needs to have the icon key added, and then you can provide the path to the icon that you want to use there.

{
  "data": {
  },
  "icon": {
    "color": "#005EB8",
    "path": "material/apartment",
    "style": {}
  },
  "label": "Place A",
  "expanded": false,
  "items": []
}

Different icons per tree item

1 Like