Studio Developer Manual / Version 2512.0
Table Of ContentsYou can import your own SVG files directly in your TypeScript code:
import myIcon from "./icons/my-icon.svg";
console.log(`SVG code:\n${typeArticle}`);Example 9.61. Importing SVG in TypeScript
Importing directly from an *.svg file requires the SVG to be located underneath the
src folder and in addition to this a type definition file custom.d.ts:
declare module "*.svg" {
const content: string;
export default content;
}Example 9.62. SVG definition
You can then use the icon in your ExtJS component by generating a CSS class for the SVG icon with the
aforementioned SvgIconUtil utility class:
import { SvgIconUtil } from "@coremedia/studio-client.base-models";
Config(Button, {
iconCls: SvgIconUtil.getIconStyleClassForSvgIcon(myIcon),
});Example 9.63. Generating CSS class for SVG icon
Section 9.3, “Studio Plugins” describes how to load external resources. You can also reference SVG icons in your SCSS code as follows:
.my-icon {
background-image: url(get-resource-path("images/example.svg"));
}Example 9.64. Get Resources in SCSS Code
Then pass the CSS class to the iconCls configuration of your component:
Due to technical limitations of the ExtJS SCSS compiler the SVG file needs to be located in the sencha/resources folder.


