{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "contacts-alphabet-list",
  "title": "Contacts Alphabet List",
  "description": "A contact list grouped by first letter with sticky headings, an edge index that jumps on tap or drag, and a count in each section. Use this when a phone screen lists more than about 30 people or items that people find by name.",
  "registryDependencies": [
    "avatar",
    "@tealmac/section-list"
  ],
  "files": [
    {
      "path": "registry/patterns/contacts-alphabet-list/contacts-alphabet-list.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { Avatar, AvatarFallback } from \"@/components/ui/avatar\"\nimport { SectionList } from \"@/components/ui/section-list\"\n\nexport interface Contact {\n  id: string\n  name: string\n  phone: string\n}\n\nexport interface ContactsAlphabetListProps {\n  contacts: Contact[]\n  onSelect?: (id: string) => void\n  className?: string\n}\n\nexport function ContactsAlphabetList({\n  contacts,\n  onSelect,\n  className,\n}: ContactsAlphabetListProps) {\n  const sections = React.useMemo(() => {\n    const map = new Map<string, Contact[]>()\n    for (const contact of [...contacts].sort((a, b) =>\n      a.name.localeCompare(b.name)\n    )) {\n      const letter = contact.name[0]?.toUpperCase() ?? \"#\"\n      map.set(letter, [...(map.get(letter) ?? []), contact])\n    }\n    return [...map].map(([id, items]) => ({\n      id,\n      title: `${id} (${items.length})`,\n      items,\n    }))\n  }, [contacts])\n\n  return (\n    <SectionList\n      label=\"Contacts\"\n      className={className}\n      sections={sections}\n      getKey={(c) => c.id}\n      renderItem={(contact) => (\n        <button\n          type=\"button\"\n          onClick={() => onSelect?.(contact.id)}\n          className=\"hover:bg-accent focus-visible:ring-ring flex min-h-14 w-full items-center gap-3 px-4 text-start outline-none focus-visible:ring-2 focus-visible:ring-inset\"\n        >\n          <Avatar aria-hidden>\n            <AvatarFallback>\n              {contact.name.slice(0, 2).toUpperCase()}\n            </AvatarFallback>\n          </Avatar>\n          <span className=\"grid\">\n            <span className=\"font-medium\">{contact.name}</span>\n            <span className=\"text-muted-foreground text-sm\">\n              {contact.phone}\n            </span>\n          </span>\n        </button>\n      )}\n    />\n  )\n}\n",
      "type": "registry:block"
    }
  ],
  "type": "registry:block"
}