Description
Describe the bug
The documentation (under Icon Content -> Notes) states:
When providing a BootstrapVue icon name, you must ensure that you have registered the corresponding icon component (either locally to your component/page, or globally), if not using the full BootstrapVueIcons plugin.
The bold part does not seem to be the case. When registering an icon with components: { BIconBuilding }
in the component where b-avatar icon="building"
is used, no icon appears.
It does works when using Vue.component('BIconBuilding', BIconBuilding)
Based on what I understand about Vue component registration, I think that it may be that the docs here are incorrect.
Steps to reproduce the bug
- Create a component that contains a b-avatar
- Set an icon to b-avatar that is not registered
- Import the icon and add it to the
components
section. - Observe that the icon does not appear
Expected behavior
Either the icon shows up as described in the docs when locally registered, or the docs change to specify that they must be globally registered with Vue.component
.
Versions
Libraries:
- BootstrapVue: 2.16.0
- Bootstrap: 4.5.2
- Vue: 2.6.12
Environment:
- Browser: any
Demo
Code Example
<template>
<!-- does not show an icon -->
<b-avatar
:src="photo"
icon="building" />
</template>
<script>
import { BIconBuilding } from 'bootstrap-vue'
export default {
components: {
BIconBuilding
}
}
</script>
Additional context
Documentation link: https://bootstrap-vue.org/docs/components/avatar/#icon-content (under Notes)