Built-In Icon Library
DevExtreme includes an icon library with SVG and font icons across all DevExtreme themes. You can use icons in UI components and in other page elements. You can also customize icons.
The following icons are available:
Icon sources are available in the DevExtreme repository on GitHub:
The source size of each icon varies by theme:
- Fluent Next / Fluent: 20 × 20 px
- Material: 24 × 24 px
- Generic: 18 × 18 px
-webkit-font-smoothing: antialiased;.Icons in DevExtreme UI Components
You can use icons in DevExtreme components that have an icon property. The following code snippet integrates icons from the built-in icon library into a Button component.
Many default templates include the icon property. The following code snippet demonstrates the default item template of the ContextMenu component:
To find a list of UI components that support icons, search for "icon" in the left-hand menu.
Icons in Other HTML Elements
You can add DevExtreme icons to non-DevExtreme HTML elements. To do this, assign the dx-icon-IconName class to an element. We recommend using inline HTML elements such as <i> or <span>.
- <i class="dx-icon-email"></i>
You can find icon names in the Built-In Icon Library article.
Customize Icons
DevExtreme icons are implemented as an icon font. You can customize icons with CSS styles specific to text content such as color, font-size, font-weight, and text-align.
DevExtreme UI components that generate icons assign the dx-icon class to all generated icons. Assign a unique id to a DevExtreme component and use it alongside the .dx-icon selector to customize all generated icons in a component simultaneously. To customize a specific generated icon, use a CSS selector with a specific icon class, such as .dx-icon-refresh. The following code snippet customizes both a specific icon and all generated icons in a Toolbar component:
To customize icons added to HTML elements, define a specific CSS class and assign styles to it.
- <i class="dx-icon-email custom-icon-style"></i>
- .custom-icon-style {
- font-size: 24px;
- color: blue;
- }
Custom Images as Icons
Assign an image URL to the icon property of a DevExtreme UI component to implement a custom icon. You can also encode images in Base64 format to avoid additional HTTP requests at the cost of increased file sizes in your project.
You can assign Base64 code directly to a component's icon property or integrate it into a CSS style. We recommend the latter approach because of the Base64 string length.
The following code snippet demonstrates how you can specify Base64 images in CSS. Replace "customicon" in the .dx-icon-customicon selector with the value you assign to component icon properties:
- .dx-icon-customicon {
- background-image: url(data:image/png;base64,... LONG BASE64 CODE IS HERE ...);
- background-repeat: no-repeat;
- background-position: 0px 0px;
- }
You can define specific icons for different UI component states. The following code snippet specifies a unique icon for selected tabs:
- .dx-tab-selected .dx-icon-customicon {
- background-image: url(data:image/png;base64,... LONG BASE64 CODE GOES HERE ...);
- background-repeat: no-repeat;
- background-position: 0px 0px;
- }
dx-tab-selected are not documented. Inspect CSS rules to determine which selectors you need to use.External Icon Libraries
DevExtreme UI components generate icons as HTML <i> elements with icon class assignments. The following code snippet demonstrates how an icon appears in the DOM:
- <i class="dx-icon dx-icon-home"></i>
DevExtreme UI components support external icon libraries that populate the DOM in the same way. Examples of such libraries include the following:
Follow the installation instructions of the library you want to integrate and set DevExtreme component icon properties as follows:
SVG Icons
In addition to font icons, DevExtreme supplies the same icons in the SVG format. You can find SVG icons in the DevExtreme repository on GitHub.
The following code uses SVG icons in the Button UI component. The same technique can be used with any other UI component that has the icon property.
Use the icon's URL:
JavaScript- new DevExpress.ui.dxButton(targetElement, {
- icon: "https://path/to/the/icon.svg"
- });
This code wraps the SVG icon inside a
<img />tag. In this case, you cannot use CSS rules to customize the SVG image.Insert SVG content inline:
JavaScript- new DevExpress.ui.dxButton(targetElement, {
- icon: "<svg>SVG_CONTENT</svg>"
- });
This code renders SVG content directly in the markup. In this case, you can use CSS rules to customize the SVG image.
Import the icon:
JavaScript- import * as myIcon from "./assets/icon.svg";
- new DevExpress.ui.dxButton(targetElement, {
- icon: myIcon
- });
This code wraps the SVG icon inside a
<img />tag. In this case, you cannot use CSS rules to customize the SVG image.