Magnolia 6.1 reached end of life on March 31, 2021. This branch is no longer supported, see End-of-life policy.
This page explains how you can provide and use custom SVG icons for apps.
Every Magnolia app has an icon assigned to it. The icon can be defined in the app descriptor with the icon
property.
It is displayed:
To use a custom icon for an app, you must:
$maven-module/src/main/resources/VAADIN/appicons
folder.icon
. Its value must be the filename without the svg
suffix.In your Maven module, add the fast-vehicle-icon.svg
file to the src/main/resources/VAADIN/appicons
folder.
my-foobar-module/ ├── pom.xml └── src └── main └── resources └── VAADIN └── appicons └── fast-vehicle-icon.svg
Make sure to add my-foobar-module
to your webapp bundle.
Reference the icon from the app descriptor of your custom app.
!content-type:tourVehicle icon: fast-vehicle-icon
Instead of using a custom app icon, you can also reference and use app icons that are part of the UI framework (see the Magnolia app icons gallery).
MagnoliaAppIcon is used to resolve custom app icons or default to a fallback icon. If no SVG icon (logo) or font icon (forCssClass) is defined, the default SVG app icon will be used as fallback.
MagnoliaAppIcon.forName(logo) .or(MagnoliaIcons::forCssClass) .or(MagnoliaIcons.APP) .ifPresent(...);