Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-import based on prop binding pattern #203

Closed
TechAkayy opened this issue May 20, 2022 · 9 comments
Closed

Auto-import based on prop binding pattern #203

TechAkayy opened this issue May 20, 2022 · 9 comments

Comments

@TechAkayy
Copy link

TechAkayy commented May 20, 2022

Thanks for this amazing plugin. I'm using auto-import via unplugin-components, unicons (prefix is 'uil') iconset in the below example (https://stackblitz.com/github/techakayy/vuetify3-beta-unplugin-icons?file=src%2FApp.vue).

So, basically, <i-uil-android> will auto-import just fine as it uses the {prefix}-{collection}-{icon} tag pattern.

But, if I'm binding the icon as a prop (uilShoppingCart in the below example), then looks like I need to manually import the icon.

Is it possible to support auto-import based on prop-binding pattern as well, for example {prefix}{Collection}{Icon} (camelCase equivalent)?

image

@userquin
Copy link
Member

userquin commented May 20, 2022

@TechAkayy you can use the v-alert slots: https://stackblitz.com/edit/github-dranvy?file=src%2FApp.vue

You should also file an issue on vuetify: the prepend slot (and maybe also the append slot) will not add the additional i, so the docs are wrong or it is a bug: https://next.vuetifyjs.com/en/api/v-alert/#slots

@TechAkayy
Copy link
Author

TechAkayy commented May 20, 2022

Many thanks @userquin. Yes, VAlert allows adding icons via slot. But, not all vuetify components supports icon via slot, for eg, VBtn, VAvatar etc, hence the above request.

@userquin
Copy link
Member

@TechAkayy
Copy link
Author

Ohh woww.. thanks bunch @userquin :-) Much appreciated. Unocss is new to me, going to explore it tonight!

@userquin
Copy link
Member

userquin commented May 20, 2022

there is no way to infer the icons, check this entry there is no way to infer a component from a dynamic string

@userquin
Copy link
Member

vuetify should add a way to use custom icons via slot instead prop

@TechAkayy
Copy link
Author

TechAkayy commented May 20, 2022

Unocss icons preset is an amazing combo for vuetify :-) I think I will leave unplugin-icons behind for now. Thanks a lot for suggesting it..

https://stackblitz.com/github/techakayy/vuetify3-beta-unocss-icons

image

@TechAkayy
Copy link
Author

Added feature request in vuetify - vuetifyjs/vuetify#15164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants