New to Telerik UI for Blazor? Start a free 30-day trial
DropDownButton Icons
Updated over 6 months ago
The <TelerikDropDownButton> and <DropDownButtonItem> provide an Icon parameter that allows you to add an icon to the main button and all secondary action items.
The Icon parameter type is object and it accepts:
- A property of the static 
SvgIconclass - A member of the 
FontIconenum - A 
stringthat is a CSS class for a custom icon 
Make sure to register
font-icons.cssif using Telerik font icons.
How to use icons in Telerik Blazor DropDownButton
<TelerikDropDownButton Icon="@SvgIcon.User">
    <DropDownButtonContent>SVG Icon</DropDownButtonContent>
    <DropDownButtonItems>
        <DropDownButtonItem Icon="@FontIcon.Gear">Font Icon</DropDownButtonItem>
        <DropDownButtonItem Icon="@CustomIconClass">Custom Icon</DropDownButtonItem>
        <DropDownButtonItem> <TelerikLoader /> Custom Markup </DropDownButtonItem>
    </DropDownButtonItems>
</TelerikDropDownButton>
<style>
    .my-icon {
        /* define a background image or a custom font icon here */
        background: purple;
        /* dimensions and other base styles will usually come from another class */
        width: 1em;
        height: 1em;
        font-size: 16px;
    }
</style>
<!-- Load this stylesheet only if using Telerik font icons -->
<link href="https://blazor.cdn.telerik.com/blazor/11.3.0/kendo-font-icons/font-icons.css" rel="stylesheet" type="text/css" />
@code {
    private string CustomIconClass { get; set; } = "my-icon";
}
Best Practices for Custom Icons and Images
- 
You can add custom icons and images through additional markup inside the
<DropDownButtonContent>, where the text is. - 
Images used as icons should generally be small enough to fit in a line of text. The primary button is an inline element and is not designed for large images. If you want to use big icon buttons, consider one of the following options:
- Define a 
Classfor the button that providesheightandwidth. The width and height can be set toautoor to a value inpx. When using a static value, it must be sufficient to accommodate the icon. - Adding your own HTML inside the 
<DropDownButtonContent>, something like:<DropDownButtonContent><img style="width: 400px; height: 400px;" src="my-icon.svg" />some text</DropDownButtonContent> 
 - Define a