Breadcrumb
Path through the hierarchy of sections with links, route parameters and menus.
When to use
Chain and links
The structure is given by items. Title can be text or Svelte snippet; href creates a real link. The last paragraph is usually left as text to show the current page.
| Script | Opportunity | Example |
|---|---|---|
| Normal hierarchy | items, href, title |
Section chain |
| Icons next to text | snippet in title |
Icons |
| Path options | path, params |
Options |
| Transitions of your router | itemRender |
Custom rendering |
| Alternative child pages | item.menu |
Item menu |
path collects hash addresses, for example #/workspace/project. Do not replace href with it for SvelteKit routes. For regular addressing, set href; for a special router contract, use itemRender and a custom a.
itemRender - snippet with arguments item, params, all items and accumulated paths. The returned markup is responsible for the address, handlers, and available name. The last element can be recognized by its position in the passed array.
Separators and submenus
separator specifies a common separator and accepts text or a snippet. Item with type:separator outputs a separate separator. If the entire sequence of separators is specified manually, set the common separator to an empty string: otherwise it will continue to appear between regular clauses.
The menu of the parent item is set via menu.items. In the current adapter, the path of the child is added to the href of the parent. Although the BreadcrumbMenuItem type contains an href, this adapter does not use it. The menu example intentionally passes path; Don't count on an independent href in such an item.
DropdownProps allows you to configure supported Dropdown properties, and dropdownIcon allows you to replace the menu indicator. dropdownIcon and title have snippet variants; the decorative icon must not duplicate the available link name.
Semantics and design
The root contains nav and an ordered list. The component does not assign aria-current itself. Pass the last item 'aria-current': 'page' or add an attribute to itemRender. Preserve the link semantics of parent items: an onclick handler without an href does not replace the navigation address.
classNames/styles work with the root, item and separator slots, including functions from props. Svelte styles contains CSS strings. General separator, dropdownIcon and semantic defaults are set by ConfigProvider.breadcrumb. Breadcrumb's component design tokens control colors, font, and spacing independently of other examples.
prefixCls specifies the full local prefix of the path, clauses, links, and delimiters. The empty string and undefined use ConfigProvider.prefixCls with the -breadcrumb suffix. type:separator separators inherit the same owner prefix. Semantic callbacks get the original local props.prefixCls; theme.cssVar.prefix independently sets the namespace of theme variables. Example of prefixes shows adjacent areas with different margins, RTL and keeps the menu open when switching.
Dropdown and Menu use their own styling: local Breadcrumb.prefixCls does not rename popup classes. In Ant Design 6.6.8, delimiters with a local prefix may retain the provider prefix and lose the side padding. Svelte gives them the owner's prefix; this is a conscious difference from this standard behavior.
Examples
Breadcrumb
These links lead to existing sections of the site. The last item indicates the current position.
<script lang="ts">
import { Breadcrumb } from '@woodger/antd';
</script>
<Breadcrumb aria-label={("Base path")} items={([
{ key: 'home', href: '/', title: "Home" },
{ key: 'components', href: '/ant-design', title: "Components" },
{ key: 'current', title: 'Breadcrumb', 'aria-current': 'page' }
])} />
Icons in points
title accepts Snippet. Decorative SVGs are hidden from the accessible tree; link labels remain text.
<script lang="ts">
import { Breadcrumb } from '@woodger/antd';
</script>
<style>
.crumb {
display: inline-flex;
align-items: center;
gap: 6px;
}
</style>
{#snippet home()}
<span class="crumb"><svg aria-hidden="true" width="14" height="14" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="1.8">
<path d="m3 10 9-7 9 7v11h-7v-7h-4v7H3Z" />
</svg><span>{("Home")}</span></span>
{/snippet}
{#snippet components()}
<span class="crumb"><svg aria-hidden="true" width="14" height="14" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="1.8">
<path d="M3 3h7v7H3Zm11 0h7v7h-7ZM3 14h7v7H3Zm11 0h7v7h-7Z" />
</svg><span>{("Components")}</span></span>
{/snippet}
<Breadcrumb aria-label={("Path with icons")} items={([
{ key: 'home', href: '/', title: home },
{ key: 'components', href: '/ant-design', title: components },
{ key: 'current', title: "Documentation" }
])} />
Route parameters
params substitutes values in title and path. The path of each point is collected from previous segments.
<script lang="ts">
import { Breadcrumb } from '@woodger/antd';
let project = $state('svelte');
</script>
<style>
label {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
margin-bottom: 16px;
}
input {
min-width: 0;
max-width: 100%;
box-sizing: border-box;
}
</style>
<label>{("Project name Breadcrumb ")}<input bind:value={project} /></label>
<Breadcrumb aria-label={("Path with parameters")} params={{ project }} items={([
{ key: 'workspace', path: 'workspace', title: "Projects" },
{ key: 'project', path: ':project', title: ':project' },
{ key: 'docs', path: 'docs', title: "Documentation" }
])} />
Common separator
separator accepts a string or Snippet. The empty string removes common delimiters.
<script lang="ts">
import { Breadcrumb } from '@woodger/antd';
let separator = $state('›');
</script>
<style>
label {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
margin-bottom: 16px;
}
</style>
<label>{("Breadcrumb separator ")}<select bind:value={separator}>
<option value="›">›</option><option value="/">/</option>
<option value="→">→</option><option value="">{("Without separator")}</option>
</select></label>
<Breadcrumb aria-label={("Path with separator")} {separator} items={([
{ key: 'workspace', title: "Projects" },
{ key: 'library', title: "Library" },
{ key: 'current', title: 'API' }
])} />
Drop-down menu item
menu.items specifies adjacent sections. Dropdown is opened with the mouse or keyboard; The menu item's path is added to the parent's path.
<script lang="ts">
import { Breadcrumb, Checkbox } from '@woodger/antd';
let hideIcon = $state(false);
let selected = $state(("Section not selected"));
</script>
<style>
.controls { margin-bottom: 16px; }
output {
display: block;
margin-top: 16px;
}
</style>
<div class="controls">
<Checkbox bind:checked={hideIcon}>
{("Hide Breadcrumb menu icon")}
</Checkbox>
</div>
<Breadcrumb
aria-label={("Menu path")}
dropdownIcon={hideIcon ? false : undefined}
items={([
{ key: 'home', path: 'workspace', title: "Projects" },
{
key: 'project', path: 'svelte', title: 'Svelte',
menu: {
items: [
{ key: 'components', path: '/components', title: "Components" },
{ key: 'themes', path: '/themes', title: "Themes" },
{ key: 'archive', title: "Archive", disabled: true }
],
onClick: info => { selected = String(info.key); }
},
dropdownProps: { trigger: 'click', 'aria-label': "Adjacent sections Breadcrumb" }
},
{ key: 'current', title: "Overview" }
])}
/>
<output aria-label={("Selected Breadcrumb section")}>{selected}</output>
Individual dividers
type=separator clauses allow you to mix separators. The general separator is disabled.
<script lang="ts">
import { Breadcrumb } from '@woodger/antd';
</script>
{#snippet arrow()}<span aria-hidden="true">→</span>{/snippet}
<Breadcrumb
aria-label={("Separately delimited path")}
separator=""
items={([
{ key: 'home', title: "Catalog" },
{ key: 'first-divider', type: 'separator', separator: ':' },
{ key: 'project', title: 'Svelte' },
{ key: 'second-divider', type: 'separator', separator: arrow },
{ key: 'current', title: "Components" }
])}
/>
Custom itemRender
Snippet receives item, params, routes and accumulated paths. The application itself selects the link for the ancestor and the text of the current item.
<script lang="ts">
import { Breadcrumb, type BreadcrumbItem } from '@woodger/antd';
const items: readonly BreadcrumbItem[] = [
{ key: 'home', path: 'workspace', title: "Projects" },
{ key: 'project', path: ':project', title: "Project" },
{ key: 'current', path: 'docs', title: "Documentation" }
];
</script>
{#snippet itemRender(
item: BreadcrumbItem,
params: Record<string, unknown>,
routes: readonly BreadcrumbItem[],
paths: readonly string[]
)}
{#if item === routes.at(-1)}
<span
aria-current="page"
>{(typeof item.title === 'string' ? item.title : '')}</span>
{:else}
<a href={(`#/${paths.join('/')}`)}>
{(item.key === 'project' ? String(params.project) : String(item.title ?? ''))}
</a>
{/if}
{/snippet}
<Breadcrumb
aria-label={("The path with your renderer")}
items={(items)}
params={{ project: 'antd-svelte' }}
{itemRender}
/>
Semantic styles
The classNames object and the styles function style root, item, and separator. Local RTL shows direction inheritance.
<script lang="ts">
import { Breadcrumb, Checkbox, ConfigProvider } from '@woodger/antd';
let rtl = $state(false);
</script>
<style>
.controls { margin-bottom: 16px; }
</style>
<div class="controls"><Checkbox bind:checked={rtl}>RTL Breadcrumb</Checkbox></div>
<ConfigProvider direction={rtl ? 'rtl' : 'ltr'}>
<Breadcrumb aria-label={("Decorated path")} separator="›"
classNames={{ root: 'semantic-breadcrumb-root', item: 'semantic-breadcrumb-item' }}
styles={({ props }) => ({
root: `
padding: 12px;
border: 1px solid var(--ant-color-primary-border);
border-radius: 8px;
`,
item: 'font-weight:600',
separator: props.separator === '›' ? 'color:var(--ant-color-success)' : ''
})}
items={([
{ key: 'home', title: "Projects" },
{ key: 'project', title: "Library" },
{ key: 'current', title: 'API' }
])}
/>
</ConfigProvider>
Component tokens
Local theme changes item colors and separator spacing. Numerical control updates separatorMargin without reloading.
<script lang="ts">
import { Breadcrumb, ConfigProvider, theme } from '@woodger/antd';
const tokens = theme.useToken();
let margin = $state(12);
</script>
<style>
label {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
margin-bottom: 16px;
}
</style>
<label>{("Separator interval ")}<input
type="range"
min="4"
max="20"
bind:value={margin}
/>
<output>{margin}px</output>
</label>
<ConfigProvider theme={{
cssVar: {}, components: {
Breadcrumb: {
separatorMargin: margin,
itemColor: tokens.token.colorTextSecondary,
lastItemColor: tokens.token.colorSuccess,
separatorColor: tokens.token.colorWarning
}
}
}}>
<Breadcrumb aria-label={("The path with your own theme")} items={([
{ key: 'home', title: "Catalog" },
{ key: 'current', title: "Components" }
])} />
</ConfigProvider>
The same local class is used with different delimiter indents. Changing the prefix preserves the open menu and links; Dropdown is processed independently.
Path and delimiter prefixes
General and local prefixCls, independent neighboring area and RTL. The open menu and indentations are preserved when switching.
<script lang="ts">
import { Breadcrumb, Checkbox, ConfigProvider, type BreadcrumbItem } from '@woodger/antd';
let custom = $state(true);
let local = $state(true);
let rtl = $state(false);
let visits = $state(0);
let selected = $state(("Section not selected"));
const prefix = $derived(custom ? 'suite' : 'ant');
const items: BreadcrumbItem[] = [
{
key: 'catalog', title: "Catalog", href: '#breadcrumb-prefix-destination',
onClick: () => { visits += 1; }
},
{
key: 'sections', title: "Sections", href: '#breadcrumb-prefix-destination',
dropdownProps: { trigger: 'click', 'aria-label': "Breadcrumb sections with prefix" },
menu: {
items: [
{ key: 'guide', title: "Manual" },
{ key: 'api', title: "API Reference" }
],
onClick: info => { selected = String(info.key); }
}
},
{ key: 'current', title: "Overview", 'aria-current': 'page' }
];
</script>
<style>
.example {
display: grid;
gap: 20px;
min-width: 0;
}
.controls {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
p { margin: 0; }
output { overflow-wrap: anywhere; }
</style>
<div class="example">
<div class="controls">
<Checkbox bind:checked={custom}>{("General prefix Breadcrumb suite")}</Checkbox>
<Checkbox bind:checked={local}>{("Local prefix Breadcrumb")}</Checkbox>
<Checkbox bind:checked={rtl}>{("RTL Breadcrumb with prefix")}</Checkbox>
</div>
<ConfigProvider prefixCls={prefix} direction={rtl ? 'rtl' : 'ltr'}
theme={{
cssVar: { prefix: 'breadcrumb-theme' }, components: {
Breadcrumb: {
separatorMargin: 12
}
}
}}>
<Breadcrumb items={(items)} prefixCls={local ? 'project-breadcrumb' : ''}
class="prefix-breadcrumb-main" aria-label={("Path with prefix")}
styles={({ props }) => ({
root: `outline: 1px ${props.prefixCls ? 'solid' : 'dashed'} var(--ant-color-primary-border)`
})} />
</ConfigProvider>
<ConfigProvider prefixCls="neighbor"
theme={{ cssVar: {}, components: { Breadcrumb: { separatorMargin: 6 } } }}>
<Breadcrumb
prefixCls={local ? 'project-breadcrumb' : ''}
separator=""
class="prefix-breadcrumb-neighbor"
aria-label={("Neighboring path with prefix")}
items={([
{ key: 'catalog', title: "Catalog" },
{ key: 'separator', type: 'separator', separator: '›' },
{ key: 'current', title: 'Svelte', 'aria-current': 'page' }
])}
/>
</ConfigProvider>
<output id="breadcrumb-prefix-destination" aria-label={("Breadcrumb state with prefix")}>{("\n General: ")}{prefix}{("; class: ")}{(local ? 'project-breadcrumb' : prefix + '-breadcrumb')}{("; transitions: ")}{visits}{("; section: ")}{selected}
</output>
<p>
{("The same local class is used with different delimiter indents. Changing the prefix preserves the open menu and links; Dropdown is processed independently.")}
</p>
</div>
Project path
Saved review example with project parameter and real menu links.
<script lang="ts">
import { Breadcrumb } from '@woodger/antd';
let project = $state('svelte');
</script>
<style>
label {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
margin-bottom: 16px;
}
</style>
<label>{("Project ")}<input bind:value={project} /></label>
<Breadcrumb
aria-label={("Project path")}
params={{ project }}
items={([
{ key: 'home', path: 'workspace', title: "Workspace" },
{
key: 'project',
path: ':project',
title: ':project',
menu: {
items: [
{ key: 'components', path: '/components', title: "Components" },
{ key: 'themes', path: '/themes', title: "Themes" }
]
},
dropdownProps: { trigger: 'click', 'aria-label': "Project sections" }
},
{ key: 'current', title: "Library" }
])}
/>
API
Examples are checked against the current ant.design page and the public API of the installed package. Full definitions of Props are in @woodger/antd.
| Theme | Example or limitation |
|---|---|
| Basic Usage | Ancestor links and current item. |
| With an Icon | Public title-snippets with SVG. |
| With Params | Substitution of params and accumulated path. |
| Configuring the Separator | Common separator and shutdown. |
| Bread crumbs with drop down menu | Menu of adjacent sections and keyboard. |
| Configuring the Separator Independently | Separate separator items. |
| Custom semantic dom styling | Classes and functional styles. |
| CSS prefix | Prefixes of links, regular and separate delimiters; saving the open menu. |
| Property | Description | Type | Default |
|---|---|---|---|
prefixCls | Full local CSS prefix for path, clauses and separators. The empty string and undefined use the provider prefix. | string | ConfigProvider.prefixCls + "-breadcrumb" |
items | Modern description of items and individual separators. | readonly BreadcrumbItem[] | — |
params | Substitution of parameters into string title and path. | Record<string, unknown> | {} |
separator | Text, number or Snippet; the empty line removes common delimiters. | BreadcrumbContent | / |
dropdownIcon | General menu icon. false or an empty line hides it; null/undefined use the standard one. | BreadcrumbContent | Icon down |
itemRender | Completely sets the contents of the item. Links and aria-current creates the application renderer. | Snippet<[item, params, routes, paths]> | — |
classNames | The root, item and separator classes. | BreadcrumbSlots | (info) => BreadcrumbSlots | — |
styles | CSS lines semantic slots; function receives props. | BreadcrumbSlots | (info) => BreadcrumbSlots | — |
class | External nav class; rootClassName is added to the same node. | string | — |
nativeElement | bind:nativeElement returns nav after mount. | HTMLElement | — |
Item parameters
BreadcrumbItem supports key, title, href or path, menu, dropdownProps, onClick, class/style and aria/data attributes. For a separate separator, specify type:separator and separator. menu.items accepts title/label, path, disabled, danger and onClick; title can be Snippet.
Semantic DOM
Root - nav with list ol. Items create li; the link uses a, the action without href uses button, and the regular caption uses span. Separators are hidden using aria-hidden. The available navigation name is set by the native aria-label.
Semantic slots: root, item, separator. the class/style of an individual item refers to its contents; styles.item - to li. aria-* and data-* from item are passed to the content. ConfigProvider.breadcrumb sets the general separator, dropdownIcon, class/style and semantic defaults.
prefixCls also applies to regular and individual separators, links, and menu item triggers. Semantic callbacks receive the original local props.prefixCls. Namespace theme.cssVar.prefix is set separately; the popup design remains with Dropdown and Menu.
Menu uses public Dropdown and its focus management. Native links retain the href and regular navigation; itemRender is responsible for its semantics.
Registration tokens
Seven component tokens work through ConfigProvider theme.components.Breadcrumb. The local theme of the card is isolated from neighboring examples; shared tokens follow the section settings.
| Token | Purpose |
|---|---|
iconFontSize | Icon size. |
itemColor | The color of a regular item. |
lastItemColor | Color of the last item. |
linkColor | Link color. |
linkHoverColor | Link hover color. |
separatorColor | Separator color. |
separatorMargin | Separator indentation on each side. |
| Token | Current value |
|---|---|
colorBgTextHover | rgba(0,0,0,0.06) |
colorPrimaryBorder | #adc6ff |
colorText | rgba(0,0,0,0.88) |
borderRadiusSM | 4 |
fontFamily | -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji' |
fontSize | 14 |
fontSizeIcon | 12 |
lineHeight | 1.5714285714285714 |
lineWidthFocus | 3 |
marginXXS | 4 |
motionDurationMid | 0.2s |
paddingXXS | 4 |
FAQ
Is React Router required?
No. For regular links, an href is sufficient. itemRender allows you to embed application routing without the React API.
How to indicate the current page?
Leave the last paragraph as text and set aria-current:page. The attribute does not appear automatically.
Where do the extra separators come from?
The general separator remains enabled for individual separator-items. For completely manual sequencing, pass an empty string.
Why is the href of a child menu item not working?
In the current adapter, the menu link is assembled from the href of the parent and the path of the child. Use the structure shown in the example.