themesberg / flowbite

Open-source UI component library and front-end development framework based on Tailwind CSS
https://flowbite.com
MIT License
7.98k stars 746 forks source link

Avatar component can't be used properly with next/image #234

Closed MicheleJohn closed 2 years ago

MicheleJohn commented 2 years ago

Is your feature request related to a problem? Please describe. Im using Next.js (^12.x.x) and i found kinda of a limitation to the Avatar component: the img prop can accept only a string type; why this is a problem? On Next.js i need to use their smart next/image component in order to be faster and SEO friendly and in this case is quite impossible, even if i omit the img prop on the Avatar component, from the source code, i see a ternary if returning a standard svg when no img is provided.

Describe the solution you'd like Maybe we can assign to the img prop also to a ReactNode type.

Describe alternatives you've considered Actually it could be more useful, assign to the img prop a callback that returns its original classnames (in order to propagate them to the next/image component) and to this callback we can provide our custom image component.

Additional context Maybe the div wrapping the final children is not useful.

zoltanszogyenyi commented 2 years ago

Hello @MicheleJohn,

Thanks for reporting the issue.

I believe that it's best to address this with the Flowbite React library and move the issue there, if it's still applicable.

Thanks.