Icon Button
The Button can accommodate an icon which enhances the meaning of the text content.
The Button provides the following methods for configuring icons:
Icon()SpriteCssClass()ImageUrl()
Use only one of them with a particular Button instance. If you define multiple properties, only one of them will be obeyed according to the order stated above.
The Icon() method displays a built-in Kendo UI icon in the Button. In current releases, the icon is rendered as SVG by default. The Button enables you to completely omit any text to be specified for its contents. For more information about SVG icons, see SVG Icons.
@(Html.Kendo().Button()
.Name("textButton")
.Icon("trash")
)If you are creating a button-like anchor instead of a Button component, use kendo.ui.icon to render a standalone SVG icon. The method inserts the SVG markup into the target element.
<a href="/products" class="k-button">
<span id="productsIcon" class="k-button-icon"></span>
<span class="k-button-text">Products</span>
</a>
<script>
kendo.ui.icon($("#productsIcon"), { icon: "plus", type: "svg" });
</script>
Alternatively, use the IconClass option to set a custom icon. It accepts a CSS class (or multiple space-separated CSS classes).
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"/>
@(Html.Kendo().Button()
.Name("buttonCustom")
.IconClass("fa fa-magic")
)The SpriteCssClass() method displays the icon as a background of a span element instead.
@(Html.Kendo().Button()
.Name("textButton")
.Content("Sample Button")
.SpriteCssClass("myDeleteIcon")
)Image icons are applied by using the ImageUrl() method and are displayed as an img element.
@(Html.Kendo().Button()
.Name("textButton")
.Content("Sample Button")
.ImageUrl("url/to/myDeleteIcon.png")
)