therufa / mdi-vue

Material design icons for vue.js
https://www.npmjs.com/package/mdi-vue
MIT License
88 stars 13 forks source link

Can't style icons with class attribute #30

Closed timhoeppner closed 4 years ago

timhoeppner commented 4 years ago

I'm unable to style an icon by passing a class to the component.

<template>
  <div>
    <circle-icon class="active" />
  </div>
</template>

The resulting <span> will not include "active".

Appears this is because you are using functional templates. You could however still accept a class attribute and merge it with the other classes defined.

I've worked around this by wrapping the icon component but would be nice if I didn't have to.

Vue.component('circle-icon', {
  components: { icon: () => import('mdi-vue/CheckboxBlankCircle') },
  render: createElement => createElement('span', [createElement('icon')])
})
therufa commented 4 years ago

Hi @timhoeppner, thank you for your remark. I have just released a new version (1.3.0) with this addition. Could you give me feedback on it?

timhoeppner commented 4 years ago

@therufa Well that was quick! Looks like its working great, thanks!