kamil-lip / bootstrap-vue-treeview

A treeview component for Bootstrap and Vue.js 2.0+
MIT License
43 stars 30 forks source link

Custom icons #29

Open vpratfr opened 2 years ago

vpratfr commented 2 years ago

Hi,

The component is great, but we would like to change the icons to fit our branding.

Would it be posssible to add a way to customize that? Some slots would do the trick I think, to replace the hardcoded SVG.

                <svg width="12"
                     height="12"
                     @click.prevent="toggle"
                     class="tree-node-icon"
                     v-if="hasChildren">
                    <path d="M2 1 L10 6 L2 11 Z"
                          class="svg-icon"/>
                </svg>

Could be something like that :

    <div  v-if="hasChildren" @click.prevent="toggle">
        <slot name="expand-icon">
                <svg width="12" height="12" class="tree-node-icon">
                    <path d="M2 1 L10 6 L2 11 Z" class="svg-icon"/>
                </svg>
           </slot>
    </div>

Same could be done to allow for a fully custom label icon