-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Incompatibility with SVG icons #5324
Comments
It still works its just a TypeScript issue see my example: https://stackblitz.com/edit/react-vsrrdc?file=src%2FApp.tsx |
Is there a way to fix this TypeScript issue? It is not compiling. Here is the updated version of your Stackblitz with the library included: |
Size="large" works fine for me: https://stackblitz.com/edit/react-vsrrdc?file=src%2FApp.tsx |
You need to remove the |
Fixed again: https://stackblitz.com/edit/react-vsrrdc?file=src%2FApp.tsx Its because SVG's are NOT fonts so |
Sorru missed a CSS reset for p-button-lg: https://stackblitz.com/edit/react-vsrrdc?file=src%2Fstyle.css |
@melloware Sorry to bother you again. // Doesn't work
// iconProps: React.HTMLProps<HTMLElement | SVGElement>;
// Doesn't work
// iconProps: React.HTMLProps<HTMLElement> | React.SVGProps<SVGSVGElement>;
// Doesn't work
// iconProps: React.SVGProps<SVGSVGElement> | React.HTMLProps<HTMLElement>;
// It works, but this will break the API. Need to find an alternative.
iconProps: React.SVGProps<SVGSVGElement>; |
yeah this is defintiely correct |
Hmm everything I am reading says |
This is throwing the following error:
You could create a new property exclusively for SVGs, something like svgIconProps.
|
Can you try this... iconProps: Omit<React.HTMLProps<HTMLElement>, 'ref'> | Omit<React.SVGProps<SVGSVGElement>, 'ref'>; |
It does not work. There are many other conflicting properties:
|
Yeah for some reason it doesn't like the Either OR. |
Yeah, that's weird. =( |
One more try this? iconProps: React.HTMLProps<Element>; its super generic. |
And also.. iconProps: React.HTMLProps<any> | React.SVGProps<any>; |
Not yet:
|
|
OK I committed that change. |
I mean, we still have integration problems between |
Describe the bug
I'm trying to use the
<Button />
component with an icon (Icon-only
) from@tabler/icons-react
, butprimereact
seems to not work properly SVG icons.Examples like the following are not working:
Here is the Typescript error for @tabler/icons-react:
And there is the error for the
<svg />
:Result:
Reproducer
No response
PrimeReact version
10.0.9
React version
18.x
Language
TypeScript
Build / Runtime
Vite
Browser(s)
Brave 1.160.110
Steps to reproduce the behavior
Just paste the code in your React + Typescript project.
Expected behavior
The icon to be displayed with the correct size.
The text was updated successfully, but these errors were encountered: