{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "avatar", "title": "Avatar", "description": "Polaris-styled Avatar component.", "dependencies": [], "devDependencies": [ "@shopify/polaris-types" ], "registryDependencies": [ "@polaris-shadcn/theme", "@polaris-shadcn/utils" ], "files": [ { "path": "registry/templates/components/ui/avatar.tsx", "content": "import * as React from \"react\";\nimport { cn } from \"../../lib/utils\";\n\ntype SAvatarProps = React.ComponentPropsWithoutRef<\"s-avatar\">;\n\nexport type AvatarSize = \"xs\" | \"sm\" | \"default\" | \"lg\" | \"xl\";\n\nexport interface AvatarProps extends Omit {\n className?: string;\n size?: AvatarSize;\n}\n\nexport type AvatarImageProps = React.ComponentPropsWithoutRef<\"img\">;\n\nexport type AvatarFallbackProps = React.ComponentPropsWithoutRef<\"span\">;\n\nconst sizeMap: Record = {\n xs: \"small-200\",\n sm: \"small\",\n default: \"base\",\n lg: \"large\",\n xl: \"large-200\",\n};\n\nconst Avatar = React.forwardRef(\n (\n {\n className,\n src,\n alt = \"\",\n initials,\n size = \"default\",\n onLoad,\n onError,\n ...props\n },\n ref,\n ) => {\n const resolvedSize = sizeMap[size] ?? sizeMap.default;\n\n return (\n \n );\n },\n);\nAvatar.displayName = \"Avatar\";\n\nconst AvatarImage = React.forwardRef(\n () => null,\n);\nAvatarImage.displayName = \"AvatarImage\";\n\nconst AvatarFallback = React.forwardRef(\n () => null,\n);\nAvatarFallback.displayName = \"AvatarFallback\";\n\nexport { Avatar, AvatarImage, AvatarFallback };\n", "type": "registry:ui" } ], "type": "registry:ui" }