How to create a custom Icon-Component with different/dynamic props #16449
Unanswered
nadelblatt
asked this question in
Q&A
Replies: 1 comment 1 reply
-
import myicon from "./svg/myicon.vue";
import { createVuetify, type IconSet, type IconProps } from 'vuetify'
const customIcons = { myicon }
const custom: IconSet = {
component: (props: IconProps) =>
h(props.tag, [h(customIcons[props.icon as string], { class: 'v-icon__svg' })]),
}
const vuetify = createVuetify({
icons: {
defaultSet: "mdi",
aliases: {
...aliases,
},
sets: {
mdi,
custom,
},
},
}); <!--page.vue-->
<template>
<v-icon icon="custom:myicon" color="blue">
</template> |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In Vuetify 2 you could define a Custom icon like this:
So you can reuse the same icon with different colors without to recreate the whole component with different colors itself.
In Vuetify 3 I have no idea how to do the same.
One of my first tries looks like this:
Can someone help me with this?
Beta Was this translation helpful? Give feedback.
All reactions