New to Telerik UI for Blazor? Download free 30-day trial

TreeView Icons

You can put an image, icon class or a font icon for each item in the TreeView to illustrate its purpose for your end users. To apply them, use the following properties:

  • for a Telerik font icon, point the IconField parameter of the component to a string field of the model that contains the corresponding icon name.

  • for a raster image, point the ImageUrlField parameter of the component to a string field of the model that contains the url to the icon (relative or absolute).

  • for a custom font icon class, point the IconClassField parameter of the component to a string field of the model that contains the desired CSS class list which provides the required rules (like font name and glyph symbol). Make sure to also reference the desired font in your app and to use its own recommendations.

The IconClassField and ImageUrlField are rendered, respectively, as <span class="the custom class" /> and as <img src="the-image-src" />

How to use icons in Telerik TreeView

@* This example shows how to add icons or images to the TreeView items
Make sure that you also refernce the OpenIconic font that comes with the Blazor App template to see the custom font icon *@

<TelerikTreeView Data="@TreeViewData">
        <TreeViewBinding IconClassField="@nameof(TreeViewModel.MyIconClass)"
                         IconField="@nameof(TreeViewModel.TelerikIcon)" />

@code {
    public List<TreeViewModel> TreeViewData { get; set; }

    protected override void OnInitialized()

    public void GenerateData()
        TreeViewData = new List<TreeViewModel>();

        TreeViewData.Add(new TreeViewModel()
            Id = 1,
            Text = "Company",
            ParentId = null,
            HasChildren = true,
            TelerikIcon = "home"

        TreeViewData.Add(new TreeViewModel()
            Id = 2,
            Text = "Contact us",
            ParentId = 1,
            HasChildren = false,
            MyIconClass = "oi oi-envelope-closed"

        TreeViewData.Add(new TreeViewModel()
            Id = 3,
            Text = "Audio",
            ParentId = null,
            MyImageUrl = ""

    public class TreeViewModel
        public int Id { get; set; }
        public string Text { get; set; }
        public bool HasChildren { get; set; }
        public int? ParentId { get; set; }
        public string TelerikIcon { get; set; }
        public string MyIconClass { get; set; }
        public string MyImageUrl { get; set; }

The result from the code snippet above, after expanding the first node


See Also

In this article