@molecule/app-breadcrumb-solid

Feature · breadcrumb · App (browser) · v1.1.4 · Apache-2.0

Solid breadcrumb navigation component

npm install @molecule/app-breadcrumb-solid

npm · Source on GitHub

How it works

@molecule/app-breadcrumb-solid 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.

import { Breadcrumb } from '@molecule/app-breadcrumb-solid'

export function Trail() {
  return (
    <Breadcrumb
      items={[
        { label: 'Home', to: '/' },
        { label: 'Projects', to: '/projects' },
        { label: 'Apollo Redesign' },
      ]}
      onNavigate={(to) => navigate(to)}
    />
  )
}

Works with: @molecule/app-solid, @molecule/app-ui, @molecule/app-ui-solid

Reference

Solid breadcrumb navigation component.

Exports Breadcrumb — the Solid 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.ts JSDoc, not this file.

Quick Start

import { Breadcrumb } from '@molecule/app-breadcrumb-solid'

export function Trail() {
  return (
    <Breadcrumb
      items={[
        { label: 'Home', to: '/' },
        { label: 'Projects', to: '/projects' },
        { label: 'Apollo Redesign' },
      ]}
      onNavigate={(to) => navigate(to)}
    />
  )
}

Type

feature

Installation

npm install @molecule/app-breadcrumb-solid @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js

API

Interfaces

Describes a single crumb entry in a breadcrumb trail.

interface BreadcrumbItem {
  /** Display text or JSX for the crumb. */
  label: JSX.Element
  /**
   * Optional `to` target. When absent the crumb renders as plain text
   * (typically the current page).
   */
  to?: string
  /** Optional leading icon. */
  icon?: JSX.Element
}

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?: JSX.Element
  /** Extra classes on the `<nav>` element. */
  className?: string
  /** `data-mol-id` for AI-agent selectors. */
  dataMolId?: string
}

Functions

Breadcrumb navigation.

Each item before the last is rendered as a link; the last item is rendered as plain text (the "current page"). Pass onNavigate to intercept clicks (e.g. hand off to a router's navigate). Without it, crumbs render as plain <a href> anchors.

This is the Solid counterpart of @molecule/app-breadcrumb-react: the same props (React names), the same ClassMap tokens, and the same DOM for the same input. The separator renders once per gap, and each gap reads the separator prop itself, so JSX (separator={<Icon />}) and accessors create one instance per gap, as React mounts one per gap. A node created once and passed as a value (separator={icon}) can live in one place only: the first gap shows it and the others show a DOM copy.

function Breadcrumb(props: BreadcrumbProps): JSX.Element
  • props — Component props (see BreadcrumbProps).

Returns: The rendered breadcrumb.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-solid ^3.14.0 || ^4.0.0
  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-solid ^1.1.0
  • solid-js ^1.8.0

Runtime Dependencies

  • @molecule/app-solid
  • @molecule/app-ui
  • @molecule/app-ui-solid
  • solid-js

Without onNavigate, crumbs render as plain <a href> (full page load in SPAs) — pass onNavigate={(to) => navigate(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. The separator renders per gap (the default /, or the separator node cloned per gap — a DOM node can only live in one place).

Translations

Translation strings are provided by @molecule/app-locales-breadcrumb.