{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "breadcrumb-responsive", "type": "registry:example", "author": "shadcn (https://ui.shadcn.com)", "registryDependencies": [ "breadcrumb" ], "files": [ { "path": "examples/breadcrumb-responsive.tsx", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport Link from \"next/link\"\n\nimport { useMediaQuery } from \"@/hooks/use-media-query\"\nimport {\n Breadcrumb,\n BreadcrumbEllipsis,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbPage,\n BreadcrumbSeparator,\n} from \"@/registry/default/ui/breadcrumb\"\nimport { Button } from \"@/registry/default/ui/button\"\nimport {\n Drawer,\n DrawerClose,\n DrawerContent,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerTitle,\n DrawerTrigger,\n} from \"@/registry/default/ui/drawer\"\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"@/registry/default/ui/dropdown-menu\"\n\nconst items = [\n { href: \"#\", label: \"Home\" },\n { href: \"#\", label: \"Documentation\" },\n { href: \"#\", label: \"Building Your Application\" },\n { href: \"#\", label: \"Data Fetching\" },\n { label: \"Caching and Revalidating\" },\n]\n\nconst ITEMS_TO_DISPLAY = 3\n\nexport default function BreadcrumbResponsive() {\n const [open, setOpen] = React.useState(false)\n const isDesktop = useMediaQuery(\"(min-width: 768px)\")\n\n return (\n \n \n \n {items[0].label}\n \n \n {items.length > ITEMS_TO_DISPLAY ? (\n <>\n \n {isDesktop ? (\n \n \n \n \n \n {items.slice(1, -2).map((item, index) => (\n \n \n {item.label}\n \n \n ))}\n \n \n ) : (\n \n \n \n \n \n \n Navigate to\n \n Select a page to navigate to.\n \n \n
\n {items.slice(1, -2).map((item, index) => (\n \n {item.label}\n \n ))}\n
\n \n \n \n \n \n
\n
\n )}\n
\n \n \n ) : null}\n {items.slice(-ITEMS_TO_DISPLAY + 1).map((item, index) => (\n \n {item.href ? (\n <>\n \n {item.label}\n \n \n \n ) : (\n \n {item.label}\n \n )}\n \n ))}\n
\n
\n )\n}\n", "type": "registry:example", "target": "" } ] }