Search code examples
javascriptmaterializejstree

change JStree icon with material icons


I can change JStree icon with fontawesome and glyphicon using code like this:

<li data-jstree='{"icon":"fa fa-user"}'>
<li data-jstree='{"icon":"glyphicon glyphicon-print"}'>

How to use Material Icons?

I tried

<li data-jstree='{"icon":"material-icons add"}'>

But doesn't work


Solution

  • I can do it by including this stylesheet:

    https://github.com/Angelmmiguel/material_icons/blob/master/app/assets/stylesheets/material_icons_unicode.css.erb

    after I include above file as CSS I can use code below to use material-icons:

    <li data-jstree='{"icon":"material-icons add"}'>