Setting the icon properties for individual icons.
Fanna1119 opened this issue · comments
Stephan Langeveld commented
it is known that we can set the properties like this
<icon-account-box style="font-size: 2em; color: red"/>
or globally in the settings for all icons like this:
Icons({
scale: 1.2, // Scale of icons against 1em
defaultStyle: '', // Style apply to icons
defaultClass: '', // Class names apply to icons
compiler: null, // 'vue2', 'vue3', 'jsx'
jsx: 'react' // 'react' or 'preact'
})
Sometimes when working with ui frameworks and custom components we would do the following:
import unlocked from '~icons/carbon/unlocked'
import locked from '~icons/carbon/locked'
<el-switch :active-icon="locked" :inactive-icon="unlocked"></el-switch>
the problem is that the icon is too small by default and i can't set the size here.
I was thinking of different ways to perhaps approach this problem.
- Maybe an ability to alternatively set the attributes like this?
import unlocked from '~icons/carbon/unlocked?width=50;color=blue'
- or perhaps a helper somehow
return {
unlocked: iconAttrs(unlocked, {width: 50, color: blue})
}
Joaquín Sánchez commented
@Fanna1119 @antfu I'll take a look via configuration, later via url params.
Joaquín Sánchez commented
Joaquín Sánchez commented