Step 18: Icons


Our dialog is still pretty much empty. Since SAPUI5 is shipped with a large icon font that contains more than 500 icons, we will add an icon to greet our users when the dialog is opened.


Step 18: Icons - 第1张  | 优通SAP


You can view and download all files at Walkthrough – Step 18.

We add an icon to the button that opens the dialog. The sap-icon://
protocol is indicating that an icon from the icon font should be loaded. The
identifier world is the readable name of the icon in the icon font.


You can look up other icons using the Icon Explorer tool in the Demo Kit.

To call any icon, use its name as listed in the Icon Explorer in sap-icon://<iconname>.


In the dialog fragment, we add an icon control to the content aggregation of the
dialog. Luckily, the icon font also comes with a “Hello World” icon that is perfect
for us here. We also define the size of the icon and set a medium margin on it.


  • Always use icon fonts rather than images wherever possible, as they are
    scalable without quality loss (vector graphics) and do not need to be loaded




17 + 9 =