nuxt / icon

The <Icon> component, supporting Iconify, Emojis and custom components.
https://stackblitz.com/edit/nuxt-icon-playground?file=app.vue
MIT License
864 stars 37 forks source link

How to set the stroke-width? #159

Closed Rednas83 closed 1 month ago

Rednas83 commented 1 month ago

Tried:

  <Icon name="feather:home" color="green" size="20%" stroke-width="2" />
  <Icon name="feather:home" color="green" size="20%" stroke-width="2px" />
  <Icon name="feather:home" color="green" size="20%" :stroke-width="'2'" />
  <Icon name="feather:home" color="green" size="20%" :stroke-width="'2px'" />
  <Icon name="feather:home" color="green" size="20%" style="stroke-width: 2" ; />
  <Icon name="feather:home" color="green" size="20%" style="stroke-width: 2px" />
Atinux commented 1 month ago

I am not sure this feature is supported though

Rednas83 commented 1 month ago

Looks like it's not although the icon set itself has support for it.

Could it be possible to add support for it?

antfu commented 1 month ago

Iconify doesn't support that: https://iconify.design/docs/icon-components/svg-framework/dimensions.html. And I am not even sure it's possible for Iconify to do that in a universal way - I think you might use a iconset that supports pre-defined storke variants.

Rednas83 commented 1 month ago

Looking at the website it is supported for some icon sets actually https://icon-sets.iconify.design/feather/home/ image

Perhaps it can be achieved with

import { appendCustomStyle } from 'iconify-icon';
appendCustomStyle('svg [stroke-width="2"] { stroke-width: 1.5; }');

More info at https://github.com/iconify/iconify/issues/196