[feat]: Request to accept avatar component to support StaticImageData as a type in its source
Feature description
Currently the Avatar component supports only string or undefined in its source parameter <Avatar src="url"> Can a feature be added so that it support static images or StaticImageData as a type
Affected component/components
Avatar
Additional Context
Additional details here...
Before submitting
- [X] I've made research efforts and searched the documentation
- [X] I've searched for existing issues and PRs
the only thing i used cn for and now it doesn't accept StaticImageData, oh well
You can modify AvatarImage in avatar.tsx in your project to support StaticImageData.
For example something like that works:
const AvatarImage = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Image>,
Omit<React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>, "src"> & {
src: string | StaticImageData;
}
>(({ className, src, ...props }, ref) => (
<AvatarPrimitive.Image
ref={ref}
className={cn("aspect-square h-full w-full", className)}
src={typeof src === "string" ? src : src.src}
{...props}
/>
));
This issue has been automatically marked as stale due to two years of inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you.
No stale. Something went wrong with the stale bot.