ui/avatar.tsx

shadcn-storybook-registry · bases/radix/components/ui/avatar.tsx · typescript · MIT
ui

Renders user avatars with fallbacks, badges, and group support.

// Source: https://github.com/lloydrichards/shadcn-storybook-registry | License: MIT | Copyright 2025 shadcn
// Provided via justclaw.it.com; keep this notice with the code.
"use client";

import { Avatar as AvatarPrimitive } from "radix-ui";
import * as React from "react";

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

function Avatar({
  className,
  size = "default",
  ...props
}: React.ComponentProps<typeof AvatarPrimitive.Root> & {
  size?: "default" | "sm" | "lg";
}) {
  return (
    <AvatarPrimitive.Root
      data-slot="avatar"
      data-size={size}
      className={cn(
        "after:border-border group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:mix-blend-darken data-[size=lg]:size-10 data-[siz

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

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

Get a free API key