bootstrap-icons-vue icon indicating copy to clipboard operation
bootstrap-icons-vue copied to clipboard

Add a generic icon component

Open remiguittaut opened this issue 2 years ago • 2 comments

It would be useful to create a generic icon component with an icon prop, so we could directly set the icon without duplicating the control, like with bootstrap-vue:

Instead of

<b-chevron-up v-if="expanded" />
<b-chevron-down v-if="!expanded" />

We could write

<b-icon :icon="expanded ? 'b-chevron-up' : 'b-chevron-down'" />

remiguittaut avatar Nov 28 '22 16:11 remiguittaut

Also need this. Not sure however how it will be handled by tree shaking. I use this lib mainly for bundle size optimization, because it will bundle only icons I use.

alcalyn avatar Jan 08 '24 08:01 alcalyn

Ok, actually I found you can achieve this by doing:

import { BIconChevronUp, BIconChevronDown } from 'bootstrap-icons-vue';
<component :is="expanded ? BIconChevronUp : BIconChevronDown" />

And I am sure only these two icons needs to be bundled.

alcalyn avatar Jan 08 '24 08:01 alcalyn