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

Incompatible icons for icon={} props #1398

Open
2 tasks done
j-vitali opened this issue May 22, 2024 · 8 comments
Open
2 tasks done

Incompatible icons for icon={} props #1398

j-vitali opened this issue May 22, 2024 · 8 comments

Comments

@j-vitali
Copy link

j-vitali commented May 22, 2024

  • I have searched the Issues to see if this bug has already been reported
  • I have tested the latest version

basically I use tsx with tabler-icons... I want to wrap my svg ico directly in icon={} props, but got ts error:

Steps to reproduce

  1. User tabler-icons/react
  2. Create a dropdown
  3. Add icon
  4. it works ok, but showing warning error.

Current behavior

Ts error

Expected behavior

Everything working fine, this is for all icon={} props not only for dropdown... :D

Context

Screenshot 2024-05-22 alle 23 15 44
@dhavalveera
Copy link
Contributor

Hey @j-vitali ,

can you try pass IconTrash as like <Dropdown.Item className="text-red-600" icon={IconTrash} /> and see if that's working for you?

@vitalijalbu
Copy link

Hey @j-vitali ,

can you try pass IconTrash as like <Dropdown.Item className="text-red-600" icon={IconTrash} /> and see if that's working for you?

yes if works, but still is red line message eslint... :D

@dhavalveera
Copy link
Contributor

Hey @j-vitali ,
can you try pass IconTrash as like <Dropdown.Item className="text-red-600" icon={IconTrash} /> and see if that's working for you?

yes if works, but still is red line message eslint... :D

the ESLint Error remains same?

@vitalijalbu
Copy link

Hey @j-vitali ,
can you try pass IconTrash as like <Dropdown.Item className="text-red-600" icon={IconTrash} /> and see if that's working for you?

yes if works, but still is red line message eslint... :D

the ESLint Error remains same?

yes right.

@dhavalveera
Copy link
Contributor

Hey @j-vitali ,
can you try pass IconTrash as like <Dropdown.Item className="text-red-600" icon={IconTrash} /> and see if that's working for you?

yes if works, but still is red line message eslint... :D

the ESLint Error remains same?

yes right.

are you using Icons from react-icons?

@vitalijalbu
Copy link

Hey @j-vitali ,
can you try pass IconTrash as like <Dropdown.Item className="text-red-600" icon={IconTrash} /> and see if that's working for you?

yes if works, but still is red line message eslint... :D

the ESLint Error remains same?

yes right.

are you using Icons from react-icons?

no, as you can see i use tabler icons

@nhatle-684
Copy link

I also has the same error with flowbite-react-icons
image

@SutuSebastian
Copy link
Collaborator

For now just cast it as the DropdownItem icon type:

<Dropdown.Item className="text-red-600" icon={IconTrash as FC<ComponentProps<"svg">>} />

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

5 participants