ui/avatar.tsx

shadcn-chat · packages/ui/src/components/ui/avatar.tsx · typescript · MIT
ui

Renders user profile images with fallback text. Used to display avatars in UI.

// Source: https://github.com/jakobhoeg/shadcn-chat | License: MIT | Copyright 2024 Jakob Hoeg Mørk
// Provided via justclaw.it.com; keep this notice with the code.
import * as React from "react";
import * as AvatarPrimitive from "@radix-ui/react-avatar";

import { cn } from "@/lib/utils";

const Avatar = React.forwardRef<
  React.ElementRef<typeof AvatarPrimitive.Root>,
  React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
>(({ className, ...props }, ref) => (
  <AvatarPrimitive.Root
    ref={ref}
    className={cn(
      "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
      className,
    )}
    {...props}
  />
));
Avatar.displayName = AvatarPrimitive.Root.displayName;

const AvatarImage = React.forwardRef<
  React.ElementRef<typeof AvatarPrimitive.Image>,
  Reac

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key