The path to the current page, with the middle folded into a menu when it gets long.
Used for
- Project path
- Run in a pipeline
- Doc location
- Folder trail
Examples
Installation
npx knowns-ui@latest add breadcrumbFor Claude Code, Cursor or Codex: installs it and wires the props to your own data.
Paste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install prompt
Install Breadcrumb from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/breadcrumb
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add breadcrumb
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/use-floating.ts
- components/ui/knowns/menu.tsx
- components/ui/knowns/breadcrumb.tsx
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/breadcrumb, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "breadcrumb" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Props
- items
{ label, href?, icon?, onClick? }[]- Root first; the last item is the current page (aria-current).
- maxItems
number- Default
4 - Longer trails fold the middle into a … Menu.
- keepStart / keepEnd
number- Default
1 / 2 - Items kept before and after the fold.
- separator
"chevron"|"slash"- Default
"chevron" - Drawn between items, hidden from screen readers.
- size
"sm"|"md"- Default
"md" - 12.5 or 13.5px text.
| Prop | Type | Default | Description |
|---|---|---|---|
| items | { label, href?, icon?, onClick? }[] | - | Root first; the last item is the current page (aria-current). |
| maxItems | number | 4 | Longer trails fold the middle into a … Menu. |
| keepStart / keepEnd | number | 1 / 2 | Items kept before and after the fold. |
| separator | "chevron" | "slash" | "chevron" | Drawn between items, hidden from screen readers. |
| size | "sm" | "md" | "md" | 12.5 or 13.5px text. |
What it handles
- 01Renders a nav with an ordered list of crumbs, root first, where the last item is the current page with aria-current page.
- 02Makes a crumb a link when it has href, a button when it only has onClick, and runs onClick on a link too for client-side routing.
- 03Folds the middle of a trail longer than maxItems into a menu button, keeping keepStart items first and keepEnd last (1 and 2 by default).
- 04Lists the folded crumbs in a Menu labelled with how many are hidden, and runs each crumb's onClick when chosen.
- 05Truncates a long label at 16rem and lets the row wrap instead of scrolling sideways.
- 06Separates crumbs with a chevron or a slash, shows an optional icon before a label, and comes in sm and md.
States
- First render
- Nothing. The trail paints as it is
- none
- Crumb hover
- The text colour moves to the foreground
- 120ms, ease out
- Overflow button hover
- The three dots get a muted background
- 120ms, ease out
- Overflow menu opens
- The folded crumbs open in the Menu panel
- none
- Trail changes
- It updates at once
- none
| State | What moves | Timing |
|---|---|---|
| First render | Nothing. The trail paints as it is | none |
| Crumb hover | The text colour moves to the foreground | 120ms, ease out |
| Overflow button hover | The three dots get a muted background | 120ms, ease out |
| Overflow menu opens | The folded crumbs open in the Menu panel | none |
| Trail changes | It updates at once | none |
Works with
When to use
When to use
- Showing where a page sits in a hierarchy, with long trails folding into a menu.
When not to use
- A full page header with title, status and actions: use Page Header.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Breadcrumb to my app and wire it to my own data.
- I need showing where a page sits in a hierarchy, with long trails folding into a menu. Set that up with the Knowns UI Breadcrumb.
- Which Breadcrumb props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "breadcrumb" }) and search_docs({ query: "breadcrumb" }).