Skip to content

Breadcrumb

Navigation breadcrumb trail with overflow collapsing. Supports icons, custom separators, and click or href navigation per item.

import { Breadcrumb } from "phoundry-ui";

Basic

Loading interactive example…

View source
basic.svelte
<script lang="ts">
import { Breadcrumb } from "phoundry-ui";
import type { BreadcrumbItem } from "phoundry-ui";
let lastClicked = $state("");
const basicItems: BreadcrumbItem[] = [
{ id: "home", label: "Home" },
{ id: "docs", label: "Docs" },
{ id: "breadcrumb", label: "Breadcrumb" },
];
</script>
<Breadcrumb
items={basicItems}
onnavigate={(item: BreadcrumbItem) => {
lastClicked = item.label;
}}
/>
{#if lastClicked}
<p class="mt-2 text-xs text-txt-tertiary">Clicked: {lastClicked}</p>
{/if}

With Icons

Loading interactive example…

View source
with-icons.svelte
<script lang="ts">
import { Breadcrumb } from "phoundry-ui";
import type { BreadcrumbItem } from "phoundry-ui";
import { PhiIcons } from "phoundry-ui";
let lastClicked = $state("");
const iconItems: BreadcrumbItem[] = [
{ id: "home", label: "Home", icon: PhiIcons.folder },
{ id: "projects", label: "Projects", icon: PhiIcons.document },
{ id: "phoundry-ui", label: "Phoundry UI", icon: PhiIcons.edit },
{ id: "components", label: "Components" },
];
</script>
<Breadcrumb
items={iconItems}
onnavigate={(item: BreadcrumbItem) => {
lastClicked = item.label;
}}
/>

Collapsed Overflow (maxVisible=3)

Loading interactive example…

View source
collapsed-overflow-maxvisible-3.svelte
<script lang="ts">
import { Breadcrumb } from "phoundry-ui";
import type { BreadcrumbItem } from "phoundry-ui";
import { PhiIcons } from "phoundry-ui";
let lastClicked = $state("");
const longItems: BreadcrumbItem[] = [
{ id: "home", label: "Home", icon: PhiIcons.folder },
{ id: "workspace", label: "Workspace" },
{ id: "projects", label: "Projects" },
{ id: "phoundry-ui", label: "Phoundry UI" },
{ id: "components", label: "Components" },
{ id: "navigation", label: "Navigation" },
{ id: "breadcrumb", label: "Breadcrumb" },
];
</script>
<Breadcrumb
items={longItems}
maxVisible={3}
onnavigate={(item: BreadcrumbItem) => {
lastClicked = item.label;
}}
/>
<p class="mt-2 text-xs text-txt-tertiary">
7 items, showing first + last 2 with an overflow menu for the rest.
</p>

Separator + larger size

Loading interactive example…

View source
separator-larger-size.svelte
<script lang="ts">
import { Breadcrumb } from "phoundry-ui";
import type { BreadcrumbItem } from "phoundry-ui";
const basicItems: BreadcrumbItem[] = [
{ id: "home", label: "Home" },
{ id: "docs", label: "Docs" },
{ id: "breadcrumb", label: "Breadcrumb" },
];
</script>
<p class="mb-2 text-xs text-txt-secondary">
Use <code>separator</code> for brand-specific glyphs; <code>size="md"</code> bumps
text and icon metrics.
</p>
<Breadcrumb items={basicItems} separator="›" size="md" />

Loading interactive example…

View source
links-vs-buttons.svelte
<script lang="ts">
import { Breadcrumb } from "phoundry-ui";
import type { BreadcrumbItem } from "phoundry-ui";
import { PhiIcons } from "phoundry-ui";
const hrefItems: BreadcrumbItem[] = [
{ id: "home", label: "Home", href: "#bc-h-home", icon: PhiIcons.folder },
{ id: "docs", label: "Docs", href: "#bc-h-docs" },
{ id: "here", label: "Current page" },
];
</script>
<p class="mb-2 text-xs text-txt-secondary">
Segments with <code>href</code> render as real links for middle crumbs; the
last segment stays plain text. Use <code>onnavigate</code> when you route with a
SPA helper instead.
</p>
<Breadcrumb items={hrefItems} />

API

From phoundry-ui@0.4.21

NameTypeDefaultDescription
itemsrequiredBreadcrumbItem[]—Breadcrumb segments in order.
onnavigate(item: BreadcrumbItem) => void—Called when a breadcrumb is clicked.
separatorstring'/'Separator character between items.
maxVisiblenumber—Max segments to show before collapsing middle items into a dropdown.
size"sm" | "md"'sm'Text and icon size.
classstring''Additional CSS classes.

From phoundry-ui@0.4.21

NameTypeDefaultDescription
idrequiredstring—Unique identifier.
labelrequiredstring—Display text.
iconstring—Iconify icon string.
hrefstring—Renders as a link instead of a button.

Usage tips

  • The last item renders as plain text (non-clickable) to indicate the current page.
  • Use maxVisible to keep the breadcrumb compact - middle items collapse into a ”…” dropdown.
  • Items with href render as <a> tags; otherwise they render as buttons that call onnavigate.
  • Set separator to "›" or ">" for alternative visual styles.
  • The overflow menu relies on --z-dropdown from components.css; define it if you override the theme stack.

CSS styling

.ph-breadcrumb is the stable identification hook for Breadcrumb. Part selectors and --_ph-* properties are internal. Component CSS is scoped and unlayered; Consumer classes remain additive and utility overrides may lose precedence.

The existing sm and md typography is preserved; icons consume the corresponding --ph-comp-icon-* tokens.

Keep the shared component stylesheet and a named Theme imported. Decorative motion respects reduced-motion preferences.

Documentation is licensed under CC BY 4.0. Phoundry names and marks remain reserved.