{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "breadcrumb",
  "title": "Breadcrumb",
  "description": "The trail from the top of the site to the current page: a labelled `<nav>` with an ordered list of links, the last item marked `aria-current=\"page\"`.",
  "registryDependencies": [
    "@ouro/lib-class-name-check",
    "@ouro/lib-cn",
    "@ouro/lib-env",
    "@ouro/lib-router-link",
    "@ouro/lib-use-dev-messages",
    "@ouro/menu"
  ],
  "files": [
    {
      "path": "registry/ouro/components/ouro/breadcrumb/breadcrumb.tsx",
      "content": "\"use client\";\n\nimport { Fragment, type JSX, type ReactNode, type Ref } from \"react\";\nimport { useAppearanceClassNameCheck } from \"@/registry/ouro/lib/ouro/class-name-check\";\nimport { cn } from \"@/registry/ouro/lib/ouro/cn\";\nimport { RouterLink } from \"@/registry/ouro/lib/ouro/router-link\";\nimport { useDevWarnings } from \"@/registry/ouro/lib/ouro/use-dev-messages\";\nimport { Menu } from \"@/registry/ouro/components/ouro/menu/menu\";\n\n/** One step of a Breadcrumb's trail. */\nexport interface BreadcrumbItem {\n  /** The page's name: \"Recipes\". */\n  label: string;\n  /**\n   * Where the step goes; internal paths go through `OuroProvider`'s `linkComponent`. Every\n   * item needs one except the last, the current page, which renders as text.\n   * @claim \"Every item needs one except the\" registry/ouro/components/ouro/breadcrumb/breadcrumb.test.tsx verify:testExists(registry/ouro/components/ouro/breadcrumb/breadcrumb.test.tsx::Breadcrumb > renders a labelled nav with an ordered list of links, the last one the current page)\n   * @claim \"Every item needs one except the\" registry/ouro/components/ouro/breadcrumb/breadcrumb.test.tsx verify:testExists(registry/ouro/components/ouro/breadcrumb/breadcrumb.test.tsx::Breadcrumb > renders the current page as text even when it has an href)\n   */\n  href?: string | undefined;\n  /**\n   * An icon before the label, as an element: `icon: <HomeIcon />`. It is hidden from\n   * screen readers, so the label still names the step.\n   */\n  icon?: ReactNode;\n}\n\n/** Props for {@link Breadcrumb}. */\nexport interface BreadcrumbProps {\n  /** The trail from the top of the site to the current page, which is the last item. */\n  items: readonly BreadcrumbItem[];\n  /**\n   * The longest trail shown in full. A longer one keeps the first item and the last ones\n   * (`maxItems - 2` of them, at least the current page) and puts the middle in a menu,\n   * which is a bottom sheet below 640px.\n   * @default 4\n   * @claim \"A longer one keeps the first\" registry/ouro/components/ouro/breadcrumb/breadcrumb.test.tsx verify:testExists(registry/ouro/components/ouro/breadcrumb/breadcrumb.test.tsx::Breadcrumb > keeps more of the trail with maxItems, and at least the first and the current page)\n   * @claim \"A longer one keeps the first\" registry/ouro/components/ouro/breadcrumb/breadcrumb.test.tsx verify:testExists(registry/ouro/components/ouro/breadcrumb/breadcrumb.test.tsx::Breadcrumb > collapses the middle of a long trail into a menu of links)\n   * @claim \"A longer one keeps the first\" registry/ouro/lib/ouro/use-sheet-presentation.ts verify:fileLine(registry/ouro/lib/ouro/use-sheet-presentation.ts, /\\(min-width: 640px\\)/)\n   */\n  maxItems?: number | undefined;\n  /** Names the navigation for screen readers. @default \"Breadcrumb\" */\n  label?: string | undefined;\n  /** The name of the \"…\" button that opens the hidden steps. @default \"More\" */\n  moreLabel?: string | undefined;\n  /** The text of the item that closes the hidden steps' sheet on a phone. @default \"Close\" */\n  closeLabel?: string | undefined;\n  /** Layout only: margins, width, grid placement (`mb-4`). Appearance classes warn in development. */\n  className?: string | undefined;\n  ref?: Ref<HTMLElement> | undefined;\n\n  /** Not a prop. Ouro UI uses `items`: `<Breadcrumb items={[{ label: \"Home\", href: \"/\" }, { label: \"Ribs\" }]} />`. */\n  links?: { 'Use <Breadcrumb items={[{ label: \"Home\", href: \"/\" }, { label: \"Ribs\" }]} />': never };\n  /** Not a prop. Breadcrumb draws its own separators. */\n  separator?: { \"Remove separator; Breadcrumb draws its own\": never };\n  /** Not rendered. The trail is data: `<Breadcrumb items={[{ label: \"Home\", href: \"/\" }, { label: \"Ribs\" }]} />`. */\n  children?: { 'Use <Breadcrumb items={[{ label: \"Home\", href: \"/\" }, { label: \"Ribs\" }]} />': never };\n}\n\n// Class strings are literal so the app's Tailwind finds them when it compiles.\n\n// 16px text and 44px targets on a coarse pointer at every width; 14px text with a fine one.\nconst text = \"text-base pointer-fine:text-sm leading-5\";\nconst crumb =\n  \"inline-flex min-h-11 min-w-11 pointer-fine:min-h-0 pointer-fine:min-w-0 items-center rounded-xs text-muted-foreground no-underline \" +\n  \"decoration-current/40 underline-offset-4 transition-colors duration-(--ouro-duration-fast) ease-[ease] pointer-fine:hover:text-foreground pointer-fine:hover:underline active:text-foreground \" +\n  \"[-webkit-tap-highlight-color:transparent] outline-ring outline-offset-2 focus-visible:outline-2 focus-visible:outline-solid\";\nconst more =\n  \"press m-0 box-border inline-flex h-11 min-w-11 pointer-fine:h-7 pointer-fine:min-w-7 cursor-pointer items-center justify-center \" +\n  \"rounded-ouro-md border-0 forced-colors:border forced-colors:border-solid bg-transparent p-0 font-[inherit] text-muted-foreground select-none touch-manipulation \" +\n  \"[-webkit-tap-highlight-color:transparent] pointer-fine:hover:bg-accent pointer-fine:hover:text-accent-foreground data-popup-open:bg-accent data-popup-open:text-accent-foreground \" +\n  \"motion-safe:active:scale-(--ouro-press-scale) outline-ring outline-offset-2 focus-visible:outline-2 focus-visible:outline-solid\";\n\nconst row = \"inline-flex min-w-0 items-center gap-x-1.5\";\n\nconst example = '<Breadcrumb items={[{ label: \"Home\", href: \"/\" }, { label: \"Ribs\" }]} />';\n\nfunction Separator(): JSX.Element {\n  return (\n    <svg\n      data-ouro-breadcrumb-separator=\"\"\n      aria-hidden=\"true\"\n      viewBox=\"0 0 16 16\"\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth=\"1.5\"\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n      className=\"size-3.5 shrink-0 text-muted-foreground/70 rtl:-scale-x-100\"\n    >\n      <path d=\"m6 3 5 5-5 5\" />\n    </svg>\n  );\n}\n\n/**\n * The trail from the top of the site to the current page: a labelled `<nav>` with an\n * ordered list of links, the last item marked `aria-current=\"page\"`. A long trail keeps\n * its first and last steps and collapses the middle into a `Menu`.\n *\n * Use `Navbar` or `Sidebar` instead for the app's main sections, and `Tabs` for views of\n * one page.\n *\n * @group Navigation\n * @see https://ui.ouroboros.bot/docs/breadcrumb\n *\n * @example\n * <Breadcrumb\n *   items={[\n *     { label: \"Home\", href: \"/\" },\n *     { label: \"Recipes\", href: \"/recipes\" },\n *     { label: \"Short ribs\" },\n *   ]}\n * />\n */\nexport function Breadcrumb(props: BreadcrumbProps): JSX.Element {\n  const {\n    items,\n    maxItems = 4,\n    label = \"Breadcrumb\",\n    moreLabel = \"More\",\n    closeLabel = \"Close\",\n    className,\n    ref,\n    // Guard props (hint types), dropped here so they never reach the DOM.\n    links,\n    separator,\n    children,\n  } = props;\n  useAppearanceClassNameCheck(\n    \"Breadcrumb\",\n    className,\n    process.env.NODE_ENV !== \"production\"\n      ? (token: string) => `remove \"${token}\"; Breadcrumb sets its own look`\n      : /* istanbul ignore next @preserve -- production only */ \"\",\n  );\n  useDevWarnings(\n    \"Breadcrumb\",\n    process.env.NODE_ENV !== \"production\"\n      ? () => {\n          const unlinked = items.slice(0, -1).find((item) => item.href === undefined);\n          return [\n            unlinked && [\n              `\"${unlinked.label}\" has no href; only the last item, the current page, goes without one`,\n              `items={[{ label: \"${unlinked.label}\", href: \"/…\" }, …]}`,\n            ],\n            links !== undefined && [\"links is not a prop\", example],\n            separator !== undefined && [\"separator is not a prop; Breadcrumb draws its own\", example],\n            children !== undefined && [\"children are not rendered; the trail is data\", example],\n          ];\n        }\n      : /* istanbul ignore next @preserve -- production only */ undefined,\n  );\n\n  // A long trail: the first step, a menu of the middle, and the last steps.\n  const tail = Math.max(1, Math.floor(maxItems) - 2);\n  const collapsed = items.length > Math.max(maxItems, tail + 1);\n  const hidden = collapsed ? items.slice(1, -tail) : [];\n  const shown = collapsed ? [items[0]!, ...items.slice(-tail)] : items;\n  const last = shown.length - 1;\n  const content = (item: BreadcrumbItem) => (\n    <>\n      {item.icon !== undefined && (\n        <span aria-hidden=\"true\" className=\"me-1.5 inline-flex shrink-0 [&_svg]:size-4\">\n          {item.icon}\n        </span>\n      )}\n      {item.label}\n    </>\n  );\n\n  return (\n    <nav ref={ref} data-ouro=\"breadcrumb\" aria-label={label} className={cn(\"min-w-0\", className)}>\n      <ol className={cn(\"m-0 flex list-none flex-wrap items-center gap-x-1.5 p-0\", text)}>\n        {shown.map((item, index) => (\n          <Fragment key={index}>\n            {index === 1 && collapsed && (\n              <li className={row}>\n                <Separator />\n                <span data-ouro-breadcrumb-item=\"\" className=\"inline-flex\">\n                  <Menu\n                    closeLabel={closeLabel}\n                    trigger={\n                      <button type=\"button\" aria-label={moreLabel} data-ouro-control=\"breadcrumb\" data-ouro-part=\"more\" className={more}>\n                        <span aria-hidden=\"true\">…</span>\n                      </button>\n                    }\n                    items={hidden.map((step) => ({ label: step.label, href: step.href, disabled: step.href === undefined }))}\n                  />\n                </span>\n              </li>\n            )}\n            <li className={row}>\n              {index > 0 && <Separator />}\n              {index === last ? (\n                <span data-ouro-breadcrumb-item=\"\" aria-current=\"page\" className=\"inline-flex items-center font-medium text-foreground\">\n                  {content(item)}\n                </span>\n              ) : item.href === undefined ? (\n                <span data-ouro-breadcrumb-item=\"\" className=\"inline-flex items-center text-muted-foreground\">\n                  {content(item)}\n                </span>\n              ) : (\n                <RouterLink data-ouro-breadcrumb-item=\"\" data-ouro-control=\"breadcrumb\" data-ouro-part=\"crumb\" href={item.href} className={crumb}>\n                  {content(item)}\n                </RouterLink>\n              )}\n            </li>\n          </Fragment>\n        ))}\n      </ol>\n    </nav>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@components/ouro/breadcrumb/breadcrumb.tsx"
    }
  ],
  "docs": "The trail from the top of the site to the current page: a labelled `<nav>` with an ordered list of links, the last item marked `aria-current=\"page\"`. Import: import { Breadcrumb } from \"@/components/ouro/breadcrumb/breadcrumb\", with @/components replaced by your components alias (aliases.components in components.json, such as ~/components). Also installed: kbd, menu, the helpers they import in lib/ouro. Needs ouro-base in your stylesheet: add that item once per app, from the same place as this one, if you have not. Docs: https://ui.ouroboros.bot/docs/breadcrumb.md Ouro UI v1.3.257.",
  "type": "registry:ui"
}