{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "avatar-group",
  "type": "registry:ui",
  "title": "Avatar Group",
  "description": "The avatar-group primitive.",
  "dependencies": [],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/avatar.json",
    "https://ui.klarhimmel.com/r/theme.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/ui/avatar-group.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/ui/avatar-group.tsx",
      "content": "import { cn } from '../lib/utils';\nimport { Avatar, type AvatarProps } from './avatar';\n\nexport interface AvatarGroupProps {\n  people: { name: string; src?: string }[];\n  /** How many show before the \"+N\" chip. Default 4. */\n  max?: number;\n  size?: Exclude<AvatarProps['size'], 'lg'>;\n  /** Names the group when the default (the names, then \"and N more\") is not what you want. */\n  'aria-label'?: string;\n  /** The chip's name: default \"3 more\". Pass it translated. */\n  moreLabel?: (n: number) => string;\n  className?: string;\n}\n\nconst overlap = { xs: '-ml-1.5', sm: '-ml-2', md: '-ml-3' };\nconst chip = { xs: 'size-6 text-[0.625rem]', sm: 'size-8 text-kh-caption', md: 'size-10 text-kh-small' };\n\n/** People who share something, overlapped; the rest collapse into a \"+N\" chip that is named, not only drawn. The group's name lists who is in it. */\nexport function AvatarGroup({ people, max = 4, size = 'sm', moreLabel = (n) => `${n} more`, className, ...aria }: AvatarGroupProps) {\n  const shown = people.slice(0, max);\n  const rest = people.length - shown.length;\n  const names = `${shown.map((p) => p.name).join(', ')}${rest > 0 ? `, ${moreLabel(rest)}` : ''}`;\n  return (\n    <div role=\"group\" aria-label={aria['aria-label'] ?? names} className={cn('flex items-center', className)}>\n      {shown.map((p, i) => (\n        <Avatar key={i} name={p.name} src={p.src} size={size} className={cn('ring-2 ring-kh-canvas', i > 0 && overlap[size])} />\n      ))}\n      {rest > 0 && (\n        <span role=\"img\" aria-label={moreLabel(rest)} className={cn('inline-flex shrink-0 select-none items-center justify-center rounded-kh-pill bg-kh-surface-3 font-medium tabular-nums text-kh-ink-2 ring-2 ring-kh-canvas', overlap[size], chip[size])}>\n          <span aria-hidden>+{rest}</span>\n        </span>\n      )}\n    </div>\n  );\n}\n"
    }
  ]
}
