bootstrap-icons-vue
bootstrap-icons-vue copied to clipboard
Add a generic icon component
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'" />
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.
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.