{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "breadcrumb",
  "title": "Breadcrumb",
  "description": "An accessible breadcrumb trail with 4 separator styles, an optional home icon, animated collapse of long paths behind an expandable ellipsis, and hover tint.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/breadcrumb/breadcrumb.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { motion, AnimatePresence } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport interface BreadcrumbItem {\n  label: string;\n  href?: string;\n  onClick?: () => void;\n  icon?: React.ReactNode;\n}\n\nexport type BreadcrumbSeparator = \"chevron\" | \"slash\" | \"dot\" | \"arrow\";\nexport type BreadcrumbSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface BreadcrumbProps {\n  items?: BreadcrumbItem[];\n  separator?: BreadcrumbSeparator | React.ReactNode;\n  maxItems?: number;\n  showHomeIcon?: boolean;\n  size?: BreadcrumbSize;\n  theme?: \"dark\" | \"light\";\n  accentColor?: string;\n  className?: string;\n}\n\nconst DEFAULT_ITEMS: BreadcrumbItem[] = [\n  { label: \"Home\", href: \"#\" },\n  { label: \"Components\", href: \"#\" },\n  { label: \"Elements\", href: \"#\" },\n  { label: \"Navigation\", href: \"#\" },\n  { label: \"Breadcrumb\" },\n];\n\nconst PALETTES = {\n  dark: { text: \"#F5F4F1\", muted: \"rgba(245,244,241,0.5)\", sep: \"rgba(245,244,241,0.28)\", hover: \"rgba(255,255,255,0.07)\", menu: \"#0E0E0E\" },\n  light: { text: \"#0A0A0A\", muted: \"rgba(10,10,10,0.5)\", sep: \"rgba(10,10,10,0.28)\", hover: \"rgba(10,10,10,0.06)\", menu: \"#FFFFFF\" },\n};\n\nconst SIZES: Record<BreadcrumbSize, { font: number; padX: number; padY: number; gap: number; icon: number }> = {\n  sm: { font: 12.5, padX: 6, padY: 3, gap: 4, icon: 13 },\n  md: { font: 14, padX: 8, padY: 4, gap: 6, icon: 15 },\n  lg: { font: 16, padX: 10, padY: 5, gap: 8, icon: 17 },\n};\n\nfunction HomeIcon({ size }: { size: number }) {\n  return (\n    <svg width={size} height={size} viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n      <path d=\"M2.5 7.2L8 2.5l5.5 4.7\" />\n      <path d=\"M3.8 6.4V13h8.4V6.4\" />\n    </svg>\n  );\n}\n\nfunction Separator({ kind, size, color }: { kind: BreadcrumbSeparator | React.ReactNode; size: number; color: string }) {\n  if (kind === \"chevron\") {\n    return (\n      <svg width={size} height={size} viewBox=\"0 0 16 16\" fill=\"none\" stroke={color} strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n        <path d=\"M6 3.5L10.5 8L6 12.5\" />\n      </svg>\n    );\n  }\n  if (kind === \"arrow\") {\n    return (\n      <svg width={size} height={size} viewBox=\"0 0 16 16\" fill=\"none\" stroke={color} strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n        <path d=\"M3 8h9.5M9 4.5L12.5 8L9 11.5\" />\n      </svg>\n    );\n  }\n  if (kind === \"slash\") {\n    return (\n      <svg width={size} height={size} viewBox=\"0 0 16 16\" fill=\"none\" stroke={color} strokeWidth=\"1.5\" strokeLinecap=\"round\" aria-hidden=\"true\">\n        <path d=\"M10.5 2.5L5.5 13.5\" />\n      </svg>\n    );\n  }\n  if (kind === \"dot\") {\n    return <span style={{ width: 4, height: 4, borderRadius: \"50%\", background: color, display: \"block\" }} />;\n  }\n  return <span style={{ color }}>{kind}</span>;\n}\n\nexport function Breadcrumb({ items = DEFAULT_ITEMS, separator = \"chevron\", maxItems, showHomeIcon = false, size = \"md\", theme = \"dark\", accentColor = \"#F2A841\", className }: BreadcrumbProps) {\n  const p = PALETTES[theme];\n  const s = SIZES[size];\n  const [expanded, setExpanded] = React.useState(false);\n  const collapsed = maxItems !== undefined && maxItems >= 2 && items.length > maxItems && !expanded;\n\n  type Entry = { kind: \"item\"; item: BreadcrumbItem; index: number } | { kind: \"ellipsis\" };\n  const entries: Entry[] = collapsed\n    ? [\n        { kind: \"item\", item: items[0], index: 0 },\n        { kind: \"ellipsis\" },\n        ...items.slice(items.length - (maxItems! - 1)).map((item, i): Entry => ({ kind: \"item\", item, index: items.length - (maxItems! - 1) + i })),\n      ]\n    : items.map((item, index): Entry => ({ kind: \"item\", item, index }));\n\n  const linkStyle = (current: boolean): React.CSSProperties => ({\n    display: \"inline-flex\",\n    alignItems: \"center\",\n    gap: s.gap,\n    padding: `${s.padY}px ${s.padX}px`,\n    borderRadius: 8,\n    fontSize: s.font,\n    fontWeight: current ? 600 : 500,\n    color: current ? p.text : p.muted,\n    transition: \"background 0.15s ease, color 0.15s ease\",\n  });\n\n  // schema.org BreadcrumbList (JSON-LD) so search engines can show the trail, skipped while the placeholder items show.\n  const jsonLd = items === DEFAULT_ITEMS\n    ? null\n    : JSON.stringify({\n        \"@context\": \"https://schema.org\",\n        \"@type\": \"BreadcrumbList\",\n        itemListElement: items.map((item, i) => ({ \"@type\": \"ListItem\", position: i + 1, name: item.label, ...(item.href ? { item: item.href } : {}) })),\n      }).replace(/</g, \"\\\\u003c\");\n\n  return (\n    <nav aria-label=\"Breadcrumb\" className={cn(\"inline-block max-w-full\", className)} style={{ fontFamily: \"Inter, sans-serif\" }}>\n      {jsonLd && <script type=\"application/ld+json\" dangerouslySetInnerHTML={{ __html: jsonLd }} />}\n      <ol className=\"m-0 flex list-none flex-wrap items-center p-0\" style={{ gap: s.gap }}>\n        <AnimatePresence initial={false} mode=\"popLayout\">\n          {entries.map((entry, i) => {\n            const isLast = i === entries.length - 1;\n            const key = entry.kind === \"ellipsis\" ? \"ellipsis\" : `${entry.item.label}-${entry.index}`;\n            let node: React.ReactNode;\n            if (entry.kind === \"ellipsis\") {\n              node = (\n                <button\n                  type=\"button\"\n                  aria-label=\"Show hidden pages\"\n                  onClick={() => setExpanded(true)}\n                  className=\"cursor-pointer border-none bg-transparent outline-none focus-visible:ring-2\"\n                  style={{ ...linkStyle(false), [\"--tw-ring-color\" as string]: accentColor }}\n                  onMouseEnter={(e) => (e.currentTarget.style.background = p.hover)}\n                  onMouseLeave={(e) => (e.currentTarget.style.background = \"transparent\")}\n                >\n                  <svg width={s.icon} height={s.icon} viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\">\n                    <circle cx=\"3.5\" cy=\"8\" r=\"1.3\" />\n                    <circle cx=\"8\" cy=\"8\" r=\"1.3\" />\n                    <circle cx=\"12.5\" cy=\"8\" r=\"1.3\" />\n                  </svg>\n                </button>\n              );\n            } else {\n              const { item, index } = entry;\n              const icon = item.icon ?? (showHomeIcon && index === 0 ? <HomeIcon size={s.icon} /> : null);\n              const inner = (\n                <>\n                  {icon}\n                  <span>{item.label}</span>\n                </>\n              );\n              if (isLast) {\n                node = (\n                  <span aria-current=\"page\" style={linkStyle(true)}>\n                    {inner}\n                  </span>\n                );\n              } else {\n                const common = {\n                  className: \"cursor-pointer border-none bg-transparent no-underline outline-none focus-visible:ring-2\",\n                  style: { ...linkStyle(false), [\"--tw-ring-color\" as string]: accentColor } as React.CSSProperties,\n                  onMouseEnter: (e: React.MouseEvent<HTMLElement>) => {\n                    e.currentTarget.style.background = p.hover;\n                    e.currentTarget.style.color = accentColor;\n                  },\n                  onMouseLeave: (e: React.MouseEvent<HTMLElement>) => {\n                    e.currentTarget.style.background = \"transparent\";\n                    e.currentTarget.style.color = p.muted;\n                  },\n                };\n                node = item.href ? (\n                  <a href={item.href} onClick={item.onClick} {...common}>\n                    {inner}\n                  </a>\n                ) : (\n                  <button type=\"button\" onClick={item.onClick} {...common}>\n                    {inner}\n                  </button>\n                );\n              }\n            }\n            return (\n              <motion.li key={key} layout className=\"flex items-center\" style={{ gap: s.gap }} initial={{ opacity: 0, x: -6 }} animate={{ opacity: 1, x: 0 }} exit={{ opacity: 0, x: -6 }} transition={{ duration: 0.18, ease: [0.16, 1, 0.3, 1] }}>\n                {node}\n                {!isLast && (\n                  <span aria-hidden=\"true\" className=\"flex items-center justify-center\" style={{ width: s.icon, height: s.icon }}>\n                    <Separator kind={separator} size={s.icon} color={p.sep} />\n                  </span>\n                )}\n              </motion.li>\n            );\n          })}\n        </AnimatePresence>\n      </ol>\n    </nav>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}