@molecule/app-breadcrumb-svelte
Feature · breadcrumb · App (browser) · v1.1.4 · Apache-2.0
Svelte breadcrumb navigation component
npm install @molecule/app-breadcrumb-svelteHow it works
@molecule/app-breadcrumb-svelte is a ready-made breadcrumb feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.
<script lang="ts">
import { Breadcrumb } from '@molecule/app-breadcrumb-svelte'
const items = [
{ label: 'Home', to: '/' },
{ label: 'Projects', to: '/projects' },
{ label: 'Apollo Redesign' },
]
</script>
<Breadcrumb {items} onNavigate={(to) => goto(to)} />Works with: @molecule/app-svelte, @molecule/app-ui, @molecule/app-ui-svelte
Reference
Svelte breadcrumb navigation component.
Exports Breadcrumb — the Svelte counterpart of
@molecule/app-breadcrumb-react with the same props and the same DOM:
a list of crumbs where each but the last is a link. The final crumb
renders as plain text with aria-current="page". Pass onNavigate to
intercept clicks and hand off to a router.
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Quick Start
<script lang="ts">
import { Breadcrumb } from '@molecule/app-breadcrumb-svelte'
const items = [
{ label: 'Home', to: '/' },
{ label: 'Projects', to: '/projects' },
{ label: 'Apollo Redesign' },
]
</script>
<Breadcrumb {items} onNavigate={(to) => goto(to)} />
Type
feature
Installation
npm install @molecule/app-breadcrumb-svelte @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte
API
Interfaces
BreadcrumbItem
Describes a single crumb entry in a breadcrumb trail.
interface BreadcrumbItem {
/** Display text or snippet for the crumb. */
label: Snippet | string
/**
* Optional `to` target. When absent the crumb renders as plain text
* (typically the current page).
*/
to?: string
/** Optional leading icon. */
icon?: Snippet | string
}
BreadcrumbProps
Props accepted by the Breadcrumb component.
interface BreadcrumbProps {
/** Ordered list of crumbs, last one usually the current page. */
items: BreadcrumbItem[]
/**
* Click handler invoked with the target `to` when an item is clicked.
* Useful when wiring to a router. When omitted the component renders
* items with an anchor `<a href={to}>`.
*/
onNavigate?: (to: string) => void
/** Separator between crumbs — defaults to a `/`. Accepts any node. */
separator?: Snippet | string
/** Extra classes on the `<nav>` element. */
className?: string
/** `data-mol-id` for AI-agent selectors. */
dataMolId?: string
}
Constants
Breadcrumb
const Breadcrumb: LegacyComponentType
Injection Notes
Requirements
Peer dependencies:
@molecule/app-svelte^3.5.0 || ^4.0.0@molecule/app-ui^1.0.1@molecule/app-ui-svelte^1.1.0svelte^5.29.0
Runtime Dependencies
@molecule/app-svelte@molecule/app-ui@molecule/app-ui-sveltesvelte
Without onNavigate, crumbs render as plain <a href> (full page
load in SPAs) — pass onNavigate={(to) => goto(to)} to stay
client-side; with it, crumbs render as <button>s. The last item (or
any item without to) renders as plain text with aria-current="page".
No router dependency is required by the component itself. Node-valued
fields (label, icon, separator) are snippets or strings; the
separator defaults to a /.
Translations
Translation strings are provided by @molecule/app-locales-breadcrumb.