Icons
The KendoReact suite delivers more than 400 integrated font icons for its components.
What Are Icon Fonts
Icon fonts are fonts which contain vector glyphs instead of letters and numbers. You can style them with CSS by using all styling properties that can be applied to a regular text in a modern browser.
Why Use Icon Fonts
The utilization of icon fonts in a user interface (UI) naturally succeeds the somehow outdated icon sprite technique.
Font icons demonstrate significant benefits such as:
- Improved scalability—While icon sprites are bitmap raster images and do not scale well, icon fonts use vector graphics, look perfect on retina displays, and make scaling as easy as setting the
font-size
configuration option. - Improved design capabilities—You can easily apply CSS effects on the fly by setting the text color, shadow, or other options for different interaction states. For example, on
:hover
. - Improved browser support—Font icons are browser-agnostic and are supported by all modern browsers.
- Reduced number of HTTP requests—To load an icon font, you need a maximum of a few HTTP requests.
- Reduced file size—A 100KB file contains approximately 500 vector icons.
Basic Usage
To use the KendoReact font icons:
-
Load a KendoReact theme into your project.
-
Assign a
k-icon
CSS class followed by a predefined class from the list of font icons to an HTML tag. For example, the<span>
element as demonstrated in the following example.<span class="k-icon k-i-calendar"></span>
Rendering with Unicode Numbers
Though the web icon font comes with a set of predefined CSS classes, you might need to use the icons with a custom CSS class name. To achieve this, set a :before
pseudo content value for the relevant icon.
<span class="k-icon my-custom-icon-class"></span>
<style>
.my-custom-icon-class:before {
content: "\e13a"; /* Adds a glyph using the Unicode character number */
}
</style>
Visual Adjustments
Icon fonts support the following options for visual enhancement:
- Application of different sizes.
- Application of icon colors.
- Flipping and rotating of icons.
Sizes
The default size of all Kendo UI icons is 16 px (Font-size: 16 px; Width: 16 px; Height: 16 px). However, Kendo UI provides the following predefined sizes for icons:
xsmall
—Font-size: 12 px; Width: 12 px; Height: 12 px.small
—Font-size: 14 px; Width: 14 px; Height: 14 px.medium
—Font-size: 16 px; Width: 16 px; Height: 16 px.large
—Font-size: 20 px; Width: 20 px; Height: 20 px.xlarge
—Font-size: 24 px; Width: 24 px; Height: 24 px.xxlarge
—Font-size: 32 px; Width: 32 px; Height: 32 px.xxxlarge
—Font-size: 48 px; Width: 48 px; Height: 48 px.
You can set each of them by using the respective class:
k-icon-xs
k-icon-sm
k-icon-md
k-icon-lg
k-icon-xl
k-icon-xxl
k-icon-xxxl
<span class="k-icon k-i-gear k-icon-xs"></span>
<span class="k-icon k-i-gear k-icon-md"></span>
<span class="k-icon k-i-gear k-icon-xl"></span>
For font icons, you can apply any custom size by using the CSS font-size
property.
<span class="k-icon k-i-gear k-icon-24"></span>
<style>
.k-icon-24 {
font-size: 24px; /* Sets icon size to 24 px */
}
</style>
For SVG icons, you can change the size with the width
and height
CSS properties.
<span class="k-svg-icon k-svg-i-gear k-icon-24"></span>
<style>
.k-icon-24 {
width: 24px;
height: 24px;
}
</style>
Colors
To set the icon color, use the color
CSS property.
<span class="k-icon k-i-gear" style="color: blue;"></span>
<span class="k-icon k-i-gear colored-icon"></span>
<style>
.colored-icon {
color: green;
}
</style>
Flipping and Rotating
To better accommodate an icon in your application, flip it by using the k-flip-h
and k-flip-v
predefined CSS classes.
<span class="k-icon k-i-pencil"></span>
<span class="k-icon k-i-pencil k-flip-h"></span>
<span class="k-icon k-i-pencil k-flip-v"></span>
<span class="k-icon k-i-pencil k-flip-h k-flip-v"></span>
You can also rotate the icon with the help of the following predefined CSS classes:
k-rotate-0
—Rotates an icon 0°.k-rotate-45
—Rotates an icon 45°.k-rotate-90
—Rotates an icon 90°.k-rotate-135
—Rotates an icon 135°.k-rotate-180
—Rotates an icon 180°.k-rotate-225
—Rotates an icon 225°.k-rotate-270
—Rotates an icon 270°.k-rotate-315
—Rotates an icon 315°.
<span class="k-icon k-i-pencil k-rotate-90"></span>
Loading Indicator
To show a loading indicator, use the k-i-loading
CSS class. You can adjust the size and color of the loading indicator in the same way you make adjustments to other icons.
<span class="k-icon k-i-loading"></span>
<span class="k-icon k-i-loading" style="font-size: 64px;"></span>
<span class="k-icon k-i-loading" style="color: limegreen;"></span>
List of Font Icons
- Actions
- Alerts and Notifications
- Editing
- Files and Folders
- Images
- Layout and Navigation
- Mapping
- Media
- Social Sharing
- Toggle