diff --git a/docs/pages/kicon.vue b/docs/pages/kicon.vue
index c4aa74cb2..368dadd37 100644
--- a/docs/pages/kicon.vue
+++ b/docs/pages/kicon.vue
@@ -2,7 +2,7 @@
- See for design guidance and a list of available icons.
+ See for design guidance and a list of available icons. If an invalid icon is used, in development Vue.js validation will warn about the error. The icon will display as a broken image icon.
diff --git a/docs/rstIconReplacements.txt b/docs/rstIconReplacements.txt
index 75b04722d..b4150f688 100644
--- a/docs/rstIconReplacements.txt
+++ b/docs/rstIconReplacements.txt
@@ -8,6 +8,7 @@
.. |back| replace:: :raw-html:``
.. |bookmarkEmpty| replace:: :raw-html:``
.. |bookmark| replace:: :raw-html:``
+.. |brokenImage| replace:: :raw-html:``
.. |channel| replace:: :raw-html:``
.. |checked| replace:: :raw-html:``
.. |check| replace:: :raw-html:``
diff --git a/lib/KIcon/iconDefinitions.js b/lib/KIcon/iconDefinitions.js
index 43df3e185..687d68970 100644
--- a/lib/KIcon/iconDefinitions.js
+++ b/lib/KIcon/iconDefinitions.js
@@ -1,4 +1,4 @@
-import { themeTokens } from '../styles/theme';
+import { themePalette, themeTokens } from '../styles/theme';
/**
* Defines all icons in the Kolibri Design System
@@ -61,6 +61,10 @@ const KolibriIcons = {
icon: require('./precompiled-icons/material-icons/error/baseline.vue').default,
defaultColor: themeTokens().error,
},
+ brokenImage: {
+ icon: require('./precompiled-icons/material-icons/broken_image/baseline.vue').default,
+ defaultColor: themePalette().grey.v_400,
+ },
// Features and links
learn: { icon: require('./precompiled-icons/material-icons/school/baseline.vue').default },
diff --git a/lib/KIcon/index.vue b/lib/KIcon/index.vue
index 9606ec6a0..f290cf92a 100644
--- a/lib/KIcon/index.vue
+++ b/lib/KIcon/index.vue
@@ -50,22 +50,28 @@
},
},
computed: {
+ selectedIcon() {
+ if (!KolibriIcons[this.icon]) {
+ return KolibriIcons.brokenImage;
+ }
+ return KolibriIcons[this.icon];
+ },
computedColor() {
if (this.disableColor) {
return null;
}
if (this.color) {
return this.color;
- } else if (KolibriIcons[this.icon].defaultColor) {
- return KolibriIcons[this.icon].defaultColor;
+ } else if (this.selectedIcon.defaultColor) {
+ return this.selectedIcon.defaultColor;
}
return this.$themeTokens.text;
},
rtlFlip() {
- return KolibriIcons[this.icon].rtlFlip && this.isRtl;
+ return this.selectedIcon.rtlFlip && this.isRtl;
},
svgIconComponent() {
- return KolibriIcons[this.icon].icon;
+ return this.selectedIcon.icon;
},
},
mounted() {