Skip to content

Contrary to the docs, registering b-avatar icon to local component does not allow it to appear in the avatar #5937

Closed
@bbugh

Description

@bbugh

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

  1. Create a component that contains a b-avatar
  2. Set an icon to b-avatar that is not registered
  3. Import the icon and add it to the components section.
  4. 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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy