Breadcrumb Responsive
A responsive breadcrumb example that collapses middle path segments into an ellipsis trigger: on desktop (min-width 768px) the ellipsis opens a dropdown menu, while on mobile it opens a bottom Drawer listing the hidden pages. Long labels are truncated on small screens and expand on medium screens and up.
Installation
Usage
import * as React from "react"import Link from "next/link"import { useMediaQuery } from "@/hooks/use-media-query"import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator,} from "@/components/ui/breadcrumb"export default function Example() { const isDesktop = useMediaQuery("(min-width: 768px)") return ( <Breadcrumb> <BreadcrumbList> <BreadcrumbItem> <BreadcrumbLink asChild> <Link href="/">Home</Link> </BreadcrumbLink> </BreadcrumbItem> <BreadcrumbSeparator /> <BreadcrumbItem> <BreadcrumbPage>Current page</BreadcrumbPage> </BreadcrumbItem> </BreadcrumbList> </Breadcrumb> )}- Showing a deep navigation path (more than three levels) in a space-constrained header on both desktop and mobile.
- Keeping the first and last breadcrumb items always visible while hiding intermediate pages behind an ellipsis.
- Providing a touch-friendly drawer on mobile instead of a small dropdown, while keeping a dropdown on desktop.
- Demonstrating how to combine useMediaQuery with Breadcrumb, DropdownMenu and Drawer components.
Examples
Full responsive breadcrumb with collapsed middle items
The complete registry example: five path segments where the middle items collapse into a dropdown on desktop and a drawer on mobile.
"use client"import * as React from "react"import Link from "next/link"import { useMediaQuery } from "@/hooks/use-media-query"import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator,} from "@/registry/new-york-v4/ui/breadcrumb"import { Button } from "@/registry/new-york-v4/ui/button"import { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger,} from "@/registry/new-york-v4/ui/drawer"import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger,} from "@/registry/new-york-v4/ui/dropdown-menu"const items = [ { href: "#", label: "Home" }, { href: "#", label: "Documentation" }, { href: "#", label: "Build Your Application" }, { href: "#", label: "Data Fetching" }, { label: "Caching and Revalidating" },]const ITEMS_TO_DISPLAY = 3export default function BreadcrumbResponsive() { const [open, setOpen] = React.useState(false) const isDesktop = useMediaQuery("(min-width: 768px)") return ( <Breadcrumb> <BreadcrumbList> <BreadcrumbItem> <BreadcrumbLink asChild> <Link href={items[0].href ?? "/"}>{items[0].label}</Link> </BreadcrumbLink> </BreadcrumbItem> <BreadcrumbSeparator /> {items.length > ITEMS_TO_DISPLAY ? ( <> <BreadcrumbItem> {isDesktop ? ( <DropdownMenu open={open} onOpenChange={setOpen}> <DropdownMenuTrigger className="flex items-center gap-1" aria-label="Toggle menu" > <BreadcrumbEllipsis className="size-4" /> </DropdownMenuTrigger> <DropdownMenuContent align="start"> {items.slice(1, -2).map((item, index) => ( <DropdownMenuItem key={index}> <Link href={item.href ? item.href : "#"}> {item.label} </Link> </DropdownMenuItem> ))} </DropdownMenuContent> </DropdownMenu> ) : ( <Drawer open={open} onOpenChange={setOpen}> <DrawerTrigger aria-label="Toggle Menu"> <BreadcrumbEllipsis className="h-4 w-4" /> </DrawerTrigger> <DrawerContent> <DrawerHeader className="text-left"> <DrawerTitle>Navigate to</DrawerTitle> <DrawerDescription> Select a page to navigate to. </DrawerDescription> </DrawerHeader> <div className="grid gap-1 px-4"> {items.slice(1, -2).map((item, index) => ( <Link key={index} href={item.href ? item.href : "#"} className="py-1 text-sm" > {item.label} </Link> ))} </div> <DrawerFooter className="pt-4"> <DrawerClose asChild> <Button variant="outline">Close</Button> </DrawerClose> </DrawerFooter> </DrawerContent> </Drawer> )} </BreadcrumbItem> <BreadcrumbSeparator /> </> ) : null} {items.slice(-ITEMS_TO_DISPLAY + 1).map((item, index) => ( <BreadcrumbItem key={index}> {item.href ? ( <> <BreadcrumbLink asChild className="max-w-20 truncate md:max-w-none" > <Link href={item.href}>{item.label}</Link> </BreadcrumbLink> <BreadcrumbSeparator /> </> ) : ( <BreadcrumbPage className="max-w-20 truncate md:max-w-none"> {item.label} </BreadcrumbPage> )} </BreadcrumbItem> ))} </BreadcrumbList> </Breadcrumb> )}Short breadcrumb without collapsing
A three-level path where no items are hidden, so the ellipsis branch is not rendered; useful as a minimal baseline.
import Link from "next/link"import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator,} from "@/components/ui/breadcrumb"export default function ShortBreadcrumb() { return ( <Breadcrumb> <BreadcrumbList> <BreadcrumbItem> <BreadcrumbLink asChild> <Link href="/">Home</Link> </BreadcrumbLink> </BreadcrumbItem> <BreadcrumbSeparator /> <BreadcrumbItem> <BreadcrumbLink asChild> <Link href="/docs">Docs</Link> </BreadcrumbLink> </BreadcrumbItem> <BreadcrumbSeparator /> <BreadcrumbItem> <BreadcrumbPage>Install</BreadcrumbPage> </BreadcrumbItem> </BreadcrumbList> </Breadcrumb> )}API reference
Accessibility
- The ellipsis trigger has an aria-label ("Toggle menu" on desktop, "Toggle Menu" on mobile) so screen readers announce its purpose instead of an unnamed icon.
- The dropdown and drawer are controlled via open/onOpenChange state, keeping the open state in sync with Radix dismissal (Escape, outside click).
- The current page is rendered as BreadcrumbPage, which carries aria-current="page" and aria-disabled semantics from the breadcrumb primitive, rather than as a link.
- Breadcrumb renders a nav element with aria-label="breadcrumb" and separators are aria-hidden, so the path is announced as a navigation landmark.
- Truncated labels on small screens keep the full text available to assistive technologies only if the consumer adds a title attribute; consider adding one for long labels.
Docs written by anthropic:claude-haiku-5-5 from the registry source.
Use with Coding Agent
Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.
Use the "Breadcrumb Responsive" component (shadcn-ui/breadcrumb-responsive) from its shadcn registry.1. Install it with: npx shadcn@latest add https://ui.shadcn.com/r/styles/new-york-v4/breadcrumb-responsive.json2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: BreadcrumbResponsive.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport * as React from "react"import Link from "next/link"import { useMediaQuery } from "@/hooks/use-media-query"import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator,} from "@/components/ui/breadcrumb"export default function Example() { const isDesktop = useMediaQuery("(min-width: 768px)") return ( <Breadcrumb> <BreadcrumbList> <BreadcrumbItem> <BreadcrumbLink asChild> <Link href="/">Home</Link> </BreadcrumbLink> </BreadcrumbItem> <BreadcrumbSeparator /> <BreadcrumbItem> <BreadcrumbPage>Current page</BreadcrumbPage> </BreadcrumbItem> </BreadcrumbList> </Breadcrumb> )}```Files & dependencies
- registry/new-york-v4/examples/breadcrumb-responsive.tsx
Looks similar, elsewhere
There is no screenshot of this item to compare yet.

