New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

Embedded Icons

This help article illustrates how to configure a RadButton with embedded icons for classic render mode.

Configure RadButton with Embedded Icons

To make the control even easier to use Telerik provides a large set of built-in icons. To use them, set the PrimaryIconCssClass or SecondaryIconCssClass property to one of the predefined CSS class names, and the respective icon will be shown on the control. The full list of the CSS classes can be found in List 1.

List 1: CSS classes of embedded icons in RadButton.

  • rbAdd
  • rbRemove
  • rbOk
  • rbCancel
  • rbUpload
  • rbDownload
  • rbPrevious
  • rbNext
  • rbOpen
  • rbAttach
  • rbSave
  • rbConfig
  • rbPrint
  • rbRefresh
  • rbSearch
  • rbHelp
  • rbCart
  • rbEdit
  • rbRSS
  • rbMail
  • rbFB
  • rbTwitter

The CssClass is composed in the following way: [r]ad[b]utton[IconName]. For example rbAdd.

Configure RadButton's Embedded Icons in Classic Render Mode

RadButton in classic render mode provides two sets of built-in icons with height of 16px and 24px (Table 1). The smaller icons are appropriate for buttons that have the default height of 22px, while the bigger icons are appropriate for 65px height buttons.

Table 1: RadButton offers two sets of built-in icons of 16px and 24px height.

Icon HeightCssClassDescription
16pxAll the classes from the List 1 (e.g., PrimaryIconCssClass = " rbOk ").Useful for buttons with default height of 22px.
24pxAll the classes from the List 1 , concatenated with the "24" string. (e.g., PrimaryIconCssClass = " rbOk24 ").Useful for buttons with height of 65px (see theCustom Height Tutorialhelp article).

Each of these built-in icons is offered with three different colors, depending on the chosen skin (see Figure 1):

  • Monochrome white icons - used by BlackMetroTouch and Glow skins.
  • Monochrome black icons - used by Metro, MetroTouch and Silk skins.
  • Colored icons - used by the rest of the skin.

The color for the embedded icons is automatically determined from the skin and cannot be modified. For example you cannot use white monochrome icons for the Windows7 skin.

Figure 1: Embedded icons in RadButton for the Classic RenderMode are provided with two predefined heights and three different colors for the corresponding skin.

Icons2

Example 1: Embedded icons in RadButton can be configured through the PrimaryIconCssClass and SecondaryIconCssClass properties. This example creates the tables from Figure 1.

ASP.NET
<style type="text/css">
	/*Format tables*/
	tr:first-child {
		font-weight: bold;
	}

	tr:nth-child(odd) {
		background: #efefef;
	}

	td {
		border: 1px solid #ddd;
	}

	table {
		display: inline;
		float: left;
	}
</style>

<telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>

<table id="table1" runat="server">
	<tr>
		<td>Class Name</td>
		<td>Colored 16px<br />
			Icons<br />
			(Default skin)
		</td>
		<td>Monochrome
			<br />
			White 16px Icons<br />
			(Glow skin)</td>
		<td>Monochrome<br />
			Black 16px Icons<br />
			(Metro skin)</td>
	</tr>
</table>
<table id="table2" runat="server">
	<tr>
		<td>Class Name</td>
		<td>Colored 24px<br />
			Icons<br />
			(Black skin)
		</td>
		<td>Monochrome<br />
			White 24px Icons<br />
			(Glow skin)</td>
		<td>Monochrome<br />
			Black 24px Icons<br />
			(Metro skin)</td>
	</tr>
</table>

Configure RadButton's Embedded Icons in Lightweight Render Mode

The embedded icons of RadButton in the Lightweight RenderMode are font icons (Figure 2) as opposed to the Classic RenderMode where sprite images are used (Figure 1). Using a font facilitates the customization of the icons. For example, you can change the icons color and font size with a single line of CSS (Figure 3 and Example 3). The list of the predefined CSS classes can be found in List 1.

Figure 2: Embedded icons of RadButton in Lightweight RenderMode for Default and Black skin.

button-icons-lightweight 01

Example 2: Declaration of two RadButtons with primary icon in Lightweight RenderMode for Default and Black skin.

ASP.NET
<telerik:RadButton ID="RadButton1" runat="server" Text="Default Skin" Skin="Default" RenderMode="Lightweight">
	<Icon PrimaryIconCssClass="rbOk" />
</telerik:RadButton>

<telerik:RadButton ID="RadButton2" runat="server" Text="Black Skin" Skin="Black" RenderMode="Lightweight">
	<Icon PrimaryIconCssClass="rbOk" />
</telerik:RadButton>

Figure 3: You can easily customize the font size and color of the embedded icons of RadButton in Lightweight RenderMode with CSS.

button-icons-lightweight 02

Example 3: Use only CSS to modify the font size and color of embedded icons of RadButton in Lightweight RenderMode.

ASP.NET
<style type="text/css">
	button.RadButton.customizeIcon .rbPrimaryIcon {
		color: red;
		font-size:15px;
	}
</style>

<telerik:RadButton ID="RadButton1" runat="server" Text="Icon Custom Size and Color" RenderMode="Lightweight" CssClass="customizeIcon">
	<Icon PrimaryIconCssClass="rbSave" PrimaryIconTop="2px" />
</telerik:RadButton>

See Also