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

Allow more types of Icons as IconProps #7

Closed
nikolaischunk opened this issue Feb 13, 2024 · 5 comments
Closed

Allow more types of Icons as IconProps #7

nikolaischunk opened this issue Feb 13, 2024 · 5 comments

Comments

@nikolaischunk
Copy link

Goal

I would like to use lucide (or any other) icon library for my icons in the expandIcon button variant.
When doing so tho, the type is not allowing it.
I managed to get around this by changing in the IconProps the Icon type to React.ReactNode and updating the Icon use from <Icon /> to {Icon}.
This allows me to use the Icon like this:
image

Problem

Now i have the problem that the expanding Animation for the Icon is not working anymore / the Icon is not showing up at all.
Could you help / update the code to allow other Icons to be animated too?

Resources

Reproduction Link: BirthdayyBot/dashboardV2

@nikolaischunk
Copy link
Author

Found a solution, will open PR

@jakobhoeg
Copy link
Owner

I don't think any of this is necessary.
Just tried using a lucide icon and it works fine as is.

@nikolaischunk
Copy link
Author

I don't think any of this is necessary. Just tried using a lucide icon and it works fine as is.

Can you show me your Implementation? It wasn't working for me.

@jakobhoeg
Copy link
Owner

jakobhoeg commented Feb 14, 2024

I don't think any of this is necessary. Just tried using a lucide icon and it works fine as is.

Can you show me your Implementation? It wasn't working for me.

import { ArrowRight } from "lucide-react";

<Button variant="expandIcon" Icon={ArrowRight} iconPlacement="right">
Test
</Button>

@nikolaischunk
Copy link
Author

Try adding properties to the ArrowRight (like color etc) and you'll see what Issue I run into. I did not know how I could add them without passing a whole Element.
--> https://lucide.dev/guide/basics/color

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