# Breadcrumb: Collapsed

> Wrap middle segments in `<BreadcrumbCollapse />`. They hide behind an ellipsis and slide open in place, and focus moves to the first revealed link. Pass `open` and `onOpenChange` to control it.

Example: https://hextaui.com/docs/breadcrumb/examples/controlled
Component docs: https://hextaui.com/docs/breadcrumb.md

## Add this example

```bash
npx shadcn@latest add https://hextaui.com/r/breadcrumb-controlled.json
```

This adds `components/examples/breadcrumb/controlled.tsx` with the Breadcrumb component and the HextaUI theme tokens.

## Source

```tsx title="components/examples/breadcrumb/controlled.tsx"
"use client"

import * as React from "react"

import {
  Breadcrumb,
  BreadcrumbCollapse,
  BreadcrumbItem,
  BreadcrumbLink,
  BreadcrumbList,
  BreadcrumbPage,
  BreadcrumbSeparator,
} from "@/components/ui/breadcrumb"
import { Button } from "@/components/ui/button"

export function BreadcrumbControlled() {
  const [open, setOpen] = React.useState(false)

  return (
    <div className="flex flex-col items-center gap-4">
      <Breadcrumb>
        <BreadcrumbList>
          <BreadcrumbItem>
            <BreadcrumbLink href="#">Home</BreadcrumbLink>
          </BreadcrumbItem>
          <BreadcrumbSeparator />
          <BreadcrumbCollapse open={open} onOpenChange={setOpen}>
            <BreadcrumbItem>
              <BreadcrumbLink href="#">Documents</BreadcrumbLink>
            </BreadcrumbItem>
            <BreadcrumbSeparator />
            <BreadcrumbItem>
              <BreadcrumbLink href="#">2026</BreadcrumbLink>
            </BreadcrumbItem>
            <BreadcrumbSeparator />
          </BreadcrumbCollapse>
          <BreadcrumbItem>
            <BreadcrumbPage>Invoices</BreadcrumbPage>
          </BreadcrumbItem>
        </BreadcrumbList>
      </Breadcrumb>
      <Button variant="outline" size="sm" onClick={() => setOpen(!open)}>
        {open ? "Collapse" : "Expand"}
      </Button>
    </div>
  )
}
```

## Props in this example

### BreadcrumbLink

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `href` | `string` | – |  |

### BreadcrumbCollapse

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `open` | `boolean` | – |  |
| `onOpenChange` | `(open: boolean) => void` | – |  |

## More Breadcrumb examples

- [Basic](https://hextaui.com/docs/breadcrumb/examples/basic.md)
- [With icons](https://hextaui.com/docs/breadcrumb/examples/with-icons.md)
- [Custom separator](https://hextaui.com/docs/breadcrumb/examples/custom-separator.md)
- [Dropdown](https://hextaui.com/docs/breadcrumb/examples/dropdown.md)
- [Ellipsis](https://hextaui.com/docs/breadcrumb/examples/ellipsis.md)
- [Link component](https://hextaui.com/docs/breadcrumb/examples/link-component.md)
- [Long content](https://hextaui.com/docs/breadcrumb/examples/long-content.md)
- [Right to left](https://hextaui.com/docs/breadcrumb/examples/rtl.md)
