Customize the expand and collapse icons in Blazor TreeView Component

13 Oct 202115 minutes to read

TreeView expand and collapse icons could be customized by using the CssClass  property of TreeView. Refer to the sample to customize expand or collapse icons.

@using Syncfusion.Blazor.Navigations
<SfTreeView TValue="DriveData" CssClass="custom">
    <TreeViewFieldsSettings TValue="DriveData" Id="NodeId" Text="NodeText" Child="Children" DataSource="@Drive" Expanded="Expanded"></TreeViewFieldsSettings>
</SfTreeView>

@code{
    public class DriveData
    {
        public string NodeId { get; set; }
        public string NodeText { get; set; }
        public bool Expanded { get; set; }
        public bool Selected { get; set; }
        public List<DriveData> Children;
    }

    List<DriveData> Drive = new List<DriveData>();

    protected override void OnInitialized()
    {
        base.OnInitialized();

        List<DriveData> Folder1 = new List<DriveData>();

        Drive.Add(new DriveData
        {
            NodeId = "01",
            NodeText = "Local Disk (C:)",
            Expanded = true,
            Children = Folder1,
        });

        List<DriveData> File1 = new List<DriveData>();

        Folder1.Add(new DriveData
        {
            NodeId = "01-01",
            NodeText = "Program Files",
            Children = File1
        });
        File1.Add(new DriveData
        {
            NodeId = "01-01-01",
            NodeText = "Windows NT"
        });

        List<DriveData> File2 = new List<DriveData>();

        Folder1.Add(new DriveData
        {
            NodeId = "01-02",
            NodeText = "Users",
            Expanded = true,
            Children = File2
        });
        File2.Add(new DriveData
        {
            NodeId = "01-02-01",
            NodeText = "Smith"
        });
        File2.Add(new DriveData
        {
            NodeId = "01-02-02",
            NodeText = "Public"
        });

        List<DriveData> File3 = new List<DriveData>();

        Folder1.Add(new DriveData
        {
            NodeId = "01-03",
            NodeText = "Windows",
            Children = File3
        });
        File3.Add(new DriveData
        {
            NodeId = "01-03-01",
            NodeText = "Boot"
        });

        List<DriveData> Folder2 = new List<DriveData>();

        Drive.Add(new DriveData
        {
            NodeId = "02",
            NodeText = "Local Disk (D:)",
            Children = Folder2,
        });
        Folder2.Add(new DriveData
        {
            NodeId = "02-01",
            NodeText = "Personals"
        });
        Folder2.Add(new DriveData
        {
            NodeId = "02-02",
            NodeText = "Projects"
        });
    }
}

<style>
    .custom .e-list-item .e-icons {
        font-family: "Customize-icon";
    }

    .custom.e-treeview .e-list-item .e-icon-expandable::before, .custom.e-treeview .e-list-item .e-icon-collapsible:before {
        content: '\e700';
        font-size: 12px;
    }

    @@font-face {
        font-family: 'Customize-icon';
        src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMj0gSRcAAAEoAAAAVmNtYXDnEOdaAAABjAAAADhnbHlmcYqIngAAAcwAAAD8aGVhZBWT124AAADQAAAANmhoZWEHmANtAAAArAAAACRobXR4C9AAAAAAAYAAAAAMbG9jYQBAAH4AAAHEAAAACG1heHABEAAxAAABCAAAACBuYW1l/qscPAAAAsgAAAJ5cG9zdIPGFvoAAAVEAAAAVgABAAADUv9qAFoEAAAA//8D6QABAAAAAAAAAAAAAAAAAAAAAwABAAAAAQAAIKcGUl8PPPUACwPoAAAAANlGSVAAAAAA2UZJUAAAAAAD6QPpAAAACAACAAAAAAAAAAEAAAADACUAAwAAAAAAAgAAAAoACgAAAP8AAAAAAAAAAQPwAZAABQAAAnoCvAAAAIwCegK8AAAB4AAxAQIAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABA5wDnAQNS/2oAWgPpAJYAAAABAAAAAAAABAAAAAPoAAAD6AAAAAAAAgAAAAMAAAAUAAMAAQAAABQABAAkAAAABAAEAAEAAOcB//8AAOcA//8AAAABAAQAAAABAAIAAAAAAEAAfgADAAAAAAPpA+kACAAWACQAAAEhFSEHMzcnIyUWEAcGICcmEDc+ATIWBQYQFxYgNzYQJy4BIgYCMf6kAWqUqMK8rgF+goKK/qCEfn5Coquf/amRkZoBkpqRkUq3xLcCKmSTybt4if6ghYKChQFgiUJBQRma/m6akZGaAZKaSElJAAMAAAAAA+gD6QAGABQAIgAAASMXNyMRIyUWEAcGICcmEDc+ATIWBQYQFxYgNzYQJy4BIgYBvrLp6JmGAW6BgYf+oYiBgUGhqqH9qZOTmgGOmpOTSrbCtgGy6ekBbwuI/qGHgYGIAV6IQEFBFpr+cZmTk5oBj5lKSUkAAAAAABIA3gABAAAAAAAAAAEAAAABAAAAAAABAA4AAQABAAAAAAACAAcADwABAAAAAAADAA4AFgABAAAAAAAEAA4AJAABAAAAAAAFAAsAMgABAAAAAAAGAA4APQABAAAAAAAKACwASwABAAAAAAALABIAdwADAAEECQAAAAIAiQADAAEECQABABwAiwADAAEECQACAA4ApwADAAEECQADABwAtQADAAEECQAEABwA0QADAAEECQAFABYA7QADAAEECQAGABwBAwADAAEECQAKAFgBHwADAAEECQALACQBdyBDdXN0b21pemUtaWNvblJlZ3VsYXJDdXN0b21pemUtaWNvbkN1c3RvbWl6ZS1pY29uVmVyc2lvbiAxLjBDdXN0b21pemUtaWNvbkZvbnQgZ2VuZXJhdGVkIHVzaW5nIFN5bmNmdXNpb24gTWV0cm8gU3R1ZGlvd3d3LnN5bmNmdXNpb24uY29tACAAQwB1AHMAdABvAG0AaQB6AGUALQBpAGMAbwBuAFIAZQBnAHUAbABhAHIAQwB1AHMAdABvAG0AaQB6AGUALQBpAGMAbwBuAEMAdQBzAHQAbwBtAGkAegBlAC0AaQBjAG8AbgBWAGUAcgBzAGkAbwBuACAAMQAuADAAQwB1AHMAdABvAG0AaQB6AGUALQBpAGMAbwBuAEYAbwBuAHQAIABnAGUAbgBlAHIAYQB0AGUAZAAgAHUAcwBpAG4AZwAgAFMAeQBuAGMAZgB1AHMAaQBvAG4AIABNAGUAdAByAG8AIABTAHQAdQBkAGkAbwB3AHcAdwAuAHMAeQBuAGMAZgB1AHMAaQBvAG4ALgBjAG8AbQAAAAACAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMBAgEDAQQAFy1hcnJvdy1jaXJjbGUtcmlnaHQtXzAxEi1hcnJvdy1jaXJjbGUtZG93bgAAAAA=) format('truetype');
        font-weight: normal;
        font-style: normal;
    }
</style>

Customizing Expand and Collapse Icon in Blazor TreeView

Customize expand/collapse icon’s position and color

The expand or collapse icon’s position and color can also customized using following CSS.

@using Syncfusion.Blazor.Navigations
<div id="treeview">
    <SfTreeView TValue="TreeViewData" CssClass="custom-tree">
        <TreeViewFieldsSettings Id="NodeId" ParentID="ParentId" DataSource="@ListData" Text="NodeText" HasChildren="HasChild" Expanded="Expanded" IconCss="IconCss"></TreeViewFieldsSettings>
    </SfTreeView>
</div>

@code
{
    public class TreeViewData
    {
        public string NodeId { get; set; }
        public string NodeText { get; set; }
        public string ParentId { get; set; }
        public bool HasChild { get; set; }
        public string IconCss { get; set; }
        public bool Expanded { get; set; }

    }

    List<TreeViewData> ListData = new List<TreeViewData>();

    protected override void OnInitialized()
    {
        base.OnInitialized();
        ListData = new List<TreeViewData>();
        ListData.Add(new TreeViewData
        {
            NodeId = "1",
            NodeText = "Installation",
            IconCss = "icon-microchip icon"
        });
        ListData.Add(new TreeViewData
        {
            NodeId = "2",
            NodeText = "Deployment",
            IconCss = "icon-thumbs-up-alt icon"
        });
        ListData.Add(new TreeViewData
        {
            NodeId = "3",
            NodeText = "Quick Start",
            IconCss = "icon-docs icon"
        });

        ListData.Add(new TreeViewData
        {
            NodeId = "4",
            NodeText = "Components",
            HasChild = true,
            IconCss = "icon-th icon",
            Expanded = true
        });
        ListData.Add(new TreeViewData
        {
            NodeId = "5",
            ParentId = "4",
            NodeText = "Calendar",
            IconCss = "icon-circle-thin icon"
        });
        ListData.Add(new TreeViewData
        {
            NodeId = "7",
            ParentId = "4",
            IconCss = "icon-circle-thin icon",
            NodeText = "DatePicker",
        });
        ListData.Add(new TreeViewData
        {
            NodeId = "8",
            ParentId = "4",
            IconCss = "icon-circle-thin icon",
            NodeText = "DateTimePicker",
        });
        ListData.Add(new TreeViewData
        {
            NodeId = "9",
            NodeText = "API Reference",
            HasChild = true,
            IconCss = "icon-code icon",
        });
        ListData.Add(new TreeViewData
        {
            NodeId = "10",
            ParentId = "9",
            NodeText = "Calendar",
            IconCss = "icon-circle-thin icon"
        });
        ListData.Add(new TreeViewData
        {
            NodeId = "11",
            ParentId = "9",
            NodeText = "DatePicker",
            IconCss = "icon-circle-thin icon"
        });
        ListData.Add(new TreeViewData
        {
            NodeId = "12",
            IconCss = "icon-chrome icon",
            NodeText = "Browser Compatibility",
        });
        ListData.Add(new TreeViewData
        {
            NodeId = "13",
            NodeText = "Upgrade Packages",
            IconCss = "icon-up-hand icon"
        });
        ListData.Add(new TreeViewData
        {
            NodeId = "14",
            NodeText = "FAQ",
            IconCss = "icon-help-circled icon"
        });
    }
}
<style>
    /*To apply border and background color for treeview*/
    #treeview {
        max-width: 400px;
        margin: auto;
        border: 1px solid #dddddd;
        border-radius: 3px;
        background: #1c86c8;
    }

    /* customize icon styles */
    .e-treeview.custom-tree .e-list-icon {
        font-family: 'fontello';
        font-size: 16px;
        margin-top: -4px;
        color: white;
    }
    /* icon styles */
    @@font-face {
        font-family: 'fontello';
        src: url('data:application/octet-stream;base64,AAEAAAAPAIAAAwBwR1NVQiCLJXoAAAD8AAAAVE9TLzI+JUkyAAABUAAAAFZjbWFw0almQAAAAagAAAIgY3Z0IAbV/vwAABfUAAAAIGZwZ22KkZBZAAAX9AAAC3BnYXNwAAAAEAAAF8wAAAAIZ2x5Zk3OJrMAAAPIAAAPrGhlYWQTw6AfAAATdAAAADZoaGVhB2gDnAAAE6wAAAAkaG10eDHm//YAABPQAAAAOGxvY2EejhqYAAAUCAAAAB5tYXhwAfYMkAAAFCgAAAAgbmFtZcydHiAAABRIAAACzXBvc3RuKDzPAAAXGAAAALRwcmVw5UErvAAAI2QAAACGAAEAAAAKADAAPgACREZMVAAObGF0bgAaAAQAAAAAAAAAAQAAAAQAAAAAAAAAAQAAAAFsaWdhAAgAAAABAAAAAQAEAAQAAAABAAgAAQAGAAAAAQAAAAEDkAGQAAUAAAJ6ArwAAACMAnoCvAAAAeAAMQECAAACAAUDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBmRWQAQOgB6BMDUv9qAFoDUgCaAAAAAQAAAAAAAAAAAAUAAAADAAAALA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AAQEVFBMusDEqLbBGLLEAARQTsDIqLbBHLLA0Ki2wSCywABZFIyAuIEaKI2E4sSsBFCstsEkssAgjQrBIKy2wSiyyAABBKy2wSyyyAAFBKy2wTCyyAQBBKy2wTSyyAQFBKy2wTiyyAABCKy2wTyyyAAFCKy2wUCyyAQBCKy2wUSyyAQFCKy2wUiyyAAA+Ky2wUyyyAAE+Ky2wVCyyAQA+Ky2wVSyyAQE+Ky2wViyyAABAKy2wVyyyAAFAKy2wWCyyAQBAKy2wWSyyAQFAKy2wWiyyAABDKy2wWyyyAAFDKy2wXCyyAQBDKy2wXSyyAQFDKy2wXiyyAAA/Ky2wXyyyAAE/Ky2wYCyyAQA/Ky2wYSyyAQE/Ky2wYiywNysusSsBFCstsGMssDcrsDsrLbBkLLA3K7A8Ky2wZSywABawNyuwPSstsGYssDgrLrErARQrLbBnLLA4K7A7Ky2waCywOCuwPCstsGkssDgrsD0rLbBqLLA5Ky6xKwEUKy2wayywOSuwOystsGwssDkrsDwrLbBtLLA5K7A9Ky2wbiywOisusSsBFCstsG8ssDorsDsrLbBwLLA6K7A8Ky2wcSywOiuwPSstsHIsswkEAgNFWCEbIyFZQiuwCGWwAyRQeLABFTAtAEu4AMhSWLEBAY5ZsAG5CAAIAGNwsQAFQrIAAQAqsQAFQrMKAgEIKrEABUKzDgABCCqxAAZCugLAAAEACSqxAAdCugBAAAEACSqxAwBEsSQBiFFYsECIWLEDZESxJgGIUVi6CIAAAQRAiGNUWLEDAERZWVlZswwCAQwquAH/hbAEjbECAEQAAA==') format('truetype');
    }

    .e-treeview.custom-tree .e-list-icon.icon-microchip::before {
        content: '\e806';
    }

    .e-treeview.custom-tree .e-list-icon.icon-thumbs-up-alt::before {
        content: '\e805';
    }

    .e-treeview.custom-tree .e-list-icon.icon-chrome::before {
        content: '\e807';
    }

    .e-treeview.custom-tree .e-list-icon.icon-up-hand::before {
        content: '\e810';
    }

    .e-treeview.custom-tree .e-list-icon.icon-docs::before {
        content: '\e802';
    }

    .e-treeview.custom-tree .e-list-icon.icon-th::before {
        content: '\e803';
    }

    .e-treeview.custom-tree .e-list-icon.icon-code::before {
        content: '\e804';
    }

    .e-treeview.custom-tree .e-list-icon.icon-help-circled::before {
        content: '\e813';
    }

    .e-treeview.custom-tree .e-list-icon.icon-circle-thin::before {
        content: '\e808';
    }

    /*To float the expand/collapse icon right*/
    .e-treeview.custom-tree .e-icon-collapsible, .e-treeview .e-icon-expandable {
        float: right;
    }
     /*To customize the expand collapse icon color*/
    .e-treeview.custom-tree .e-icon-collapsible::before, .e-treeview.custom-tree .e-icon-expandable::before {
        color: white;
    }

    /*To change the text color for treeview*/
    .e-treeview .e-text-content > .e-list-text {
        color: white;
    }
</style>

Customizing Icon Position and Color in Blazor TreeView

Increase the padding between the text, expand/collapse icon and custom icons

The padding between the text, expand or collapse icon and custom icons can be increased using the following CSS in the above sample.

/* customize icon styles */
    .e-treeview.custom-tree .e-list-icon {
        font-family: 'fontello';
        font-size: 16px;
        margin-top: -4px;
        color: white;
        /*To increase the padding between icon and text*/
        margin-left: -20px;
    }

    /*To float the expand/collapse icon right*/
    .e-treeview.custom-tree .e-icon-collapsible, .e-treeview .e-icon-expandable {
        float: right;
        /*To increase the space between the text and chevron*/
        margin-right: 20px;
    }
     /*To change the text color for treeview*/
    .e-treeview .e-text-content > .e-list-text {
        color: white;
        /*To increase the padding between the text*/
        padding-left: 25px;
    }

Increasing Spaces between Icon and Text in Blazor TreeView