-
Notifications
You must be signed in to change notification settings - Fork 47
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
Add icon property to uui-button component #785
Comments
It could also some similar this with |
I did consider that, but figured it's still more code than a property accepting an icon name - I've gone with |
Yes, I guess it comes to responsibility of the different parts as components can easily end up with a lot of properties/attributes where some only is relevant based on other attribute values. Perhaps a single Or I am not sure there's a use-case for two icons in button at the same time (and not sure if I like it), but currently I think the slotted content allows to insert several icons. |
Another suggestion: leading and trailing icons |
I like the idea of separating the position to a separate attribute, and then allowing only the single icon. If anyone wants multiple icons, they can always slot whatever they need to make whatever horrible buttons their heart desires... |
Yes, it is what PrimeVue for instance does https://primevue.org/button/#icons |
@bjarnef Funny you should mention PrimeVue. I like the way Vuetify does it, if you just want to show an icon, you use the "icon" attribute. You can also use prepend-icon and append-icon for more specific cases. And you have prepend and append slots (notice no "icon" in the name here). |
That lands somewhere close to what I've implemented in #786, minus the slots:
Happy to revisit my approach if it makes more sense to add slots too |
@iOvergaard yes, I mentioned PrimeVue because we use it in a current headless project + Nuxt 3 using Delivery API on Umbraco Cloud 😎 |
To save lazy developers like me from having to slot a
uui-icon
element in buttons, we could add anicon
property to the button element, and render the icon if the property exists. Even better,icon-prepend
andicon-append
for extra options.That would also allow the library to control layout (eg whitespace between icon and text) and remove the need for specifying the
compact
attribute for icon-only buttons.The text was updated successfully, but these errors were encountered: