-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Icon in NavItem #267
Comments
Hey @akiarostami 👋, thanks for checking out Svelte UX. There are a few things here to mention 😁.
Lastly, there is Along with all the above, when using <Button
icon={{ data: mdiTrashCan, size: "2rem", style: "color: crimson" }}
color="danger"
>
Delete
</Button> additionally, while we don't at the moment, we could support passing the icon as a slot... <Button>
<Icon slot="icon" data={mdiTrashCan} />
Delete
</Button> With probably way more context than you were looking for... regarding NavItem, the short answer is
Button should also be updated to support passing an |
A few more things :) You should be able to use icon component libraries via slots, but like mentioned in I'm typically not a big fan of using individual icon components per icon ( Another thing worth mentioning with Button is while icon props as an object can be useful... <Button
icon={{ data: mdiTrashCan, size: "2rem", style: "color: crimson" }}
color="danger"
>
Delete
</Button> mostly the same can be accomplished with <Button
icon={mdiTrashCan}
classes={{ icon: "text-danger-300 text-lg" }}
color="danger"
>
Delete
</Button> |
Thank you for the detailed answer, @techniq. Very helpful. |
I am fairly new to svelte-us, so I hope I'm not missing something obvious.
I was trying to get NavItem to show an icon from Lucide, but I couldn't. I started looking at the source code of the components, and it seems that the way icons are handled in Buttons is very different from NavItem. This is the Icon part of NavItem:
and this is what I saw in Button:
One seem to be using
path
, and the other one checks for several options, exceptpath
.My question is why we have two different ways to handle something that seems to have the same logic and are very similar? Also, is there a way to simply pass a component as Icon (there are many libraries doing that already, such as Licide, and there's no way to reimplement everything)?
I apologize in advance if I get this totally wrong. As I said, I'm just getting familiar with svelte-ux.
The text was updated successfully, but these errors were encountered: