# 面包屑

- 页面: https://jiguang132.com/zh/resources/material-ui/docs/breadcrumbs
- 资源: Material UI (https://jiguang132.com/zh/resources/material-ui.md)
- 全部指南: https://jiguang132.com/zh/resources/material-ui/docs.md

说明页面层级，并提供返回上级页面的链接。

本指南覆盖默认 Emotion 环境的 Material UI Core；扩展包与额外示例按清单单独标注。

## 使用场景与业务边界

层级和路由由宿主提供；标明当前页面，不把每项都做成无效链接。

## 原生组成与范围

`Breadcrumbs`, `Link`, `Typography`

保持 Material UI 原生组合与类型，不替换为 JGuang／Base UI／Radix 同名 API。示例条目不是额外组件。

## 原生安装与初始化

```bash
npm install @mui/material@9.4.0 @emotion/react@11.14.0 @emotion/styled@11.14.1
```

采用原生 npm 包与 Emotion，不提供虚构的 JGuang UI Registry 地址。将示例放在原生 ThemeProvider 内，按项目选择 CssBaseline 或 ScopedCssBaseline。先检查 React、现有 Provider、锁文件与 SSR 配置；不要覆盖用户文件或忽略 peer 冲突。本批实际验收 React 19.2.8；React 18 及以下须匹配 react-is。完整初始化规则见随附的双语 setup 文档。

## 关键原生参数

仅解释本指南选出的关键参数，不是平铺的通用 API。原生继承来源、slot 结构、可空值与泛型仍按固定源码保留。

| 所属组件.属性 | 用途说明 | 声明来源 |
| --- | --- | --- |
| `Breadcrumbs.maxItems` | Breadcrumbs 出现原生折叠控件之前的最大项数。 | `Breadcrumbs` |
| `Breadcrumbs.separator` | Breadcrumbs 视觉分隔符，不作为可访问名称。 | `Breadcrumbs` |
| `Breadcrumbs.itemsBeforeCollapse` | Breadcrumbs 折叠时保留的开头项数。 | `Breadcrumbs` |
| `Breadcrumbs.itemsAfterCollapse` | Breadcrumbs 折叠时保留的末尾项数。 | `Breadcrumbs` |

## 可运行原生示例

下列机器键只选择示例入口，不会作为通用 variant 属性传入每个组件。原生示例 JSX 与数据保持上游原文；JGuang 编写的验收示例明确标注。

- 基础面包屑 · `BasicBreadcrumbs` · 上游原生示例
- 当前页面面包屑 · `ActiveLastBreadcrumb` · 上游原生示例
- 自定义分隔符 · `CustomSeparator` · 上游原生示例
- 带图标的面包屑 · `IconBreadcrumbs` · 上游原生示例
- 折叠面包屑 · `CollapsedBreadcrumbs` · 上游原生示例
- 紧凑菜单面包屑 · `CondensedWithMenu` · 上游原生示例
- 定制样式 · `CustomizedBreadcrumbs` · 上游原生示例

## 尚未支持的额外示例

这些条目仍保留在上游清单中，不静默跳过，也不展示为已完成预览。需要补充依赖／框架验收后再纳入可运行列表。

- React Router 扩展 · `RouterBreadcrumbs`: `react-router`

## 真实使用示例

固定版本的未修改原生示例；复制时同时保留所需的局部辅助文件。

```tsx
import * as React from 'react';
import Typography from '@mui/material/Typography';
import Breadcrumbs from '@mui/material/Breadcrumbs';
import Link from '@mui/material/Link';

function handleClick(event: React.MouseEvent<HTMLDivElement, MouseEvent>) {
  event.preventDefault();
  console.info('You clicked a breadcrumb.');
}

export default function BasicBreadcrumbs() {
  return (
    <div role="presentation" onClick={handleClick}>
      <Breadcrumbs aria-label="breadcrumb">
        <Link underline="hover" color="inherit" href="/">
          MUI
        </Link>
        <Link
          underline="hover"
          color="inherit"
          href="/material-ui/getting-started/installation/"
        >
          Core
        </Link>
        <Typography sx={{ color: 'text.primary' }}>Breadcrumbs</Typography>
      </Breadcrumbs>
    </div>
  );
}

```

## 示例依赖边界

`react`, `@mui/material/Typography`, `@mui/material/Breadcrumbs`, `@mui/material/Link`, `@mui/material/Stack`, `@mui/icons-material/NavigateNext`, `@mui/icons-material/Home`, `@mui/icons-material/Whatshot`, `@mui/icons-material/Grain`, `@mui/material/Menu`, `@mui/material/MenuItem`, `@mui/material/IconButton`, `@mui/icons-material/MoreHoriz`, `@mui/material/styles`, `@mui/material/Chip`, `@mui/icons-material/ExpandMore`

直接导入 Icons／System／Utils 的示例需要匹配 9.4.0 包。局部数据与辅助文件属于示例闭包，不是额外组件。远程图片和模拟操作不提供后端。

## 固定上游 API 元数据参考

以下表格保留上游元数据，不是重新推断的通用类型体系。条件泛型、继承属性与回调细节以以下源码声明为准。主题默认配置可能覆盖元数据默认值。

### Breadcrumbs

```tsx
import Breadcrumbs from '@mui/material/Breadcrumbs';
import { Breadcrumbs } from '@mui/material';
```

原生继承: `Typography`. 父级与 DOM 属性未被伪造为本组件新属性。

| 属性 | 必需 | 上游元数据类型／约束 | 元数据默认值 |
| --- | --- | --- | --- |
| `children` | 否 | `node` | — |
| `classes` | 否 | `object` | — |
| `component` | 否 | `elementType` | — |
| `expandText` | 否 | `string` | `'Show path'` |
| `itemsAfterCollapse` | 否 | `integer` | `1` |
| `itemsBeforeCollapse` | 否 | `integer` | `1` |
| `maxItems` | 否 | `integer` | `8` |
| `separator` | 否 | `node` | `'/'` |
| `slotProps` | 否 | `{ collapsedIcon?: func \| object }` | `{}` |
| `slots` | 否 | `{ CollapsedIcon?: elementType }` | `{}` |
| `sx` | 否 | `Array<func \| object \| bool> \| func \| object` | — |



### Link

```tsx
import Link from '@mui/material/Link';
import { Link } from '@mui/material';
```

原生继承: `Typography`. 父级与 DOM 属性未被伪造为本组件新属性。

| 属性 | 必需 | 上游元数据类型／约束 | 元数据默认值 |
| --- | --- | --- | --- |
| `children` | 否 | `node` | — |
| `classes` | 否 | `object` | — |
| `color` | 否 | `'primary' \| 'secondary' \| 'success' \| 'error' \| 'info' \| 'warning' \| 'textPrimary' \| 'textSecondary' \| 'textDisabled' \| string` | `'primary'` |
| `component` | 否 | `element type` | — |
| `sx` | 否 | `Array<func \| object \| bool> \| func \| object` | — |
| `TypographyClasses` | 否 | `object` | — |
| `underline` | 否 | `'always' \| 'hover' \| 'none'` | `'always'` |
| `variant` | 否 | `'body1' \| 'body2' \| 'button' \| 'caption' \| 'h1' \| 'h2' \| 'h3' \| 'h4' \| 'h5' \| 'h6' \| 'inherit' \| 'overline' \| 'subtitle1' \| 'subtitle2' \| string` | `'inherit'` |



### Typography

```tsx
import Typography from '@mui/material/Typography';
import { Typography } from '@mui/material';
```

| 属性 | 必需 | 上游元数据类型／约束 | 元数据默认值 |
| --- | --- | --- | --- |
| `align` | 否 | `'center' \| 'inherit' \| 'justify' \| 'left' \| 'right'` | `'inherit'` |
| `children` | 否 | `node` | — |
| `classes` | 否 | `object` | — |
| `color` | 否 | `'primary' \| 'secondary' \| 'success' \| 'error' \| 'info' \| 'warning' \| 'textPrimary' \| 'textSecondary' \| 'textDisabled' \| string` | — |
| `component` | 否 | `elementType` | — |
| `gutterBottom` | 否 | `bool` | `false` |
| `noWrap` | 否 | `bool` | `false` |
| `sx` | 否 | `Array<func \| object \| bool> \| func \| object` | — |
| `variant` | 否 | `'body1' \| 'body2' \| 'button' \| 'caption' \| 'h1' \| 'h2' \| 'h3' \| 'h4' \| 'h5' \| 'h6' \| 'inherit' \| 'overline' \| 'subtitle1' \| 'subtitle2' \| string` | `'body1'` |
| `variantMapping` | 否 | `object` | `{ h1: 'h1', h2: 'h2', h3: 'h3', h4: 'h4', h5: 'h5', h6: 'h6', subtitle1: 'h6', subtitle2: 'h6', body1: 'p', body2: 'p', inherit: 'p', }` |


## 原生源码声明

声明与 import 从固定源码提取，不平铺联合类型或外部继承。英文注释／类型属于原始源码参考，不代表上游正文已全文翻译。共享类型仍位于原生包中。

### vendor/src/Breadcrumbs/Breadcrumbs.d.ts

```ts
import * as React from 'react';

import { SxProps } from '@mui/system';

import { SlotComponentProps } from '../utils/types';

import { Theme } from '../styles';

import { OverridableComponent, OverrideProps } from '../OverridableComponent';

import { BreadcrumbsClasses } from './breadcrumbsClasses';

import SvgIcon from '../SvgIcon';

export interface BreadcrumbsCollapsedIconSlotPropsOverrides {}

export interface BreadcrumbsOwnerState extends BreadcrumbsProps {
  expanded: boolean;
}

export interface BreadcrumbsOwnProps {
  /**
   * The content of the component.
   */
  children?: React.ReactNode;
  /**
   * Override or extend the styles applied to the component.
   */
  classes?: Partial<BreadcrumbsClasses> | undefined;
  /**
   * The components used for each slot inside the Breadcumb.
   * Either a string to use a HTML element or a component.
   * @default {}
   */
  slots?:
    | {
        CollapsedIcon?: React.ElementType | undefined;
      }
    | undefined;
  /**
   * The props used for each slot inside the Breadcumb.
   * @default {}
   */
  slotProps?:
    | {
        /**
         * Props applied to the CollapsedIcon slot.
         * @default {}
         */
        collapsedIcon?:
          | SlotComponentProps<
              typeof SvgIcon,
              BreadcrumbsCollapsedIconSlotPropsOverrides,
              BreadcrumbsOwnerState
            >
          | undefined;
      }
    | undefined;
  /**
   * Override the default label for the expand button.
   *
   * For localization purposes, you can use the provided [translations](https://mui.com/material-ui/guides/localization/).
   * @default 'Show path'
   */
  expandText?: string | undefined;
  /**
   * If max items is exceeded, the number of items to show after the ellipsis.
   * @default 1
   */
  itemsAfterCollapse?: number | undefined;
  /**
   * If max items is exceeded, the number of items to show before the ellipsis.
   * @default 1
   */
  itemsBeforeCollapse?: number | undefined;
  /**
   * Specifies the maximum number of breadcrumbs to display. When there are more
   * than the maximum number, only the first `itemsBeforeCollapse` and last `itemsAfterCollapse`
   * will be shown, with an ellipsis in between.
   * @default 8
   */
  maxItems?: number | undefined;
  /**
   * Custom separator node.
   * @default '/'
   */
  separator?: React.ReactNode;
  /**
   * The system prop that allows defining system overrides as well as additional CSS styles.
   */
  sx?: SxProps<Theme> | undefined;
}

export interface BreadcrumbsTypeMap<
  AdditionalProps = {},
  RootComponent extends React.ElementType = 'nav',
> {
  props: AdditionalProps & BreadcrumbsOwnProps;
  defaultComponent: RootComponent;
}

declare const Breadcrumbs: OverridableComponent<BreadcrumbsTypeMap>;

export type BreadcrumbsProps<
  RootComponent extends React.ElementType = BreadcrumbsTypeMap['defaultComponent'],
  AdditionalProps = {},
> = OverrideProps<BreadcrumbsTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
  component?: React.ElementType | undefined;
};
```

### vendor/src/Link/Link.d.ts

```ts
import * as React from 'react';

import { DistributiveOmit } from '@mui/types';

import { SxProps } from '@mui/system';

import { OverridableComponent, OverrideProps } from '../OverridableComponent';

import { Theme } from '../styles';

import { TypographyOwnProps } from '../Typography';

import { LinkClasses } from './linkClasses';

export interface LinkOwnProps extends DistributiveOmit<LinkBaseProps, 'classes'> {
  /**
   * The content of the component.
   */
  children?: React.ReactNode;
  /**
   * Override or extend the styles applied to the component.
   */
  classes?: Partial<LinkClasses> | undefined;
  /**
   * The color of the link.
   * @default 'primary'
   */
  color?: TypographyOwnProps['color'] | 'inherit' | undefined;
  /**
   * The system prop that allows defining system overrides as well as additional CSS styles.
   */
  sx?: SxProps<Theme> | undefined;
  /**
   * `classes` prop applied to the [`Typography`](https://mui.com/material-ui/api/typography/) element.
   */
  TypographyClasses?: TypographyOwnProps['classes'] | undefined;
  /**
   * Controls when the link should have an underline.
   * @default 'always'
   */
  underline?: 'none' | 'hover' | 'always' | undefined;
  /**
   * Applies the theme typography styles.
   * @default 'inherit'
   */
  variant?: TypographyOwnProps['variant'] | undefined;
}

export interface LinkTypeMap<AdditionalProps = {}, RootComponent extends React.ElementType = 'a'> {
  props: AdditionalProps & LinkOwnProps;
  defaultComponent: RootComponent;
}

declare const Link: OverridableComponent<LinkTypeMap>;

export type LinkBaseProps = DistributiveOmit<
  TypographyOwnProps,
  'children' | 'color' | 'variant' | 'classes'
>;

export type LinkProps<
  RootComponent extends React.ElementType = LinkTypeMap['defaultComponent'],
  AdditionalProps = {},
> = OverrideProps<LinkTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
  component?: React.ElementType | undefined;
};
```

### vendor/src/Typography/Typography.d.ts

```ts
import * as React from 'react';

import { OverridableStringUnion } from '@mui/types';

import { SxProps } from '@mui/system';

import { Theme, TypeText } from '../styles';

import { OverrideProps, OverridableComponent } from '../OverridableComponent';

import { TypographyVariant } from '../styles/createTypography';

import { TypographyClasses } from './typographyClasses';

export interface TypographyPropsVariantOverrides {}

export interface TypographyPropsColorOverrides {}

export interface TypographyOwnProps {
  /**
   * Set the text-align on the component.
   * @default 'inherit'
   */
  align?: 'inherit' | 'left' | 'center' | 'right' | 'justify' | undefined;
  /**
   * The content of the component.
   */
  children?: React.ReactNode;
  /**
   * Override or extend the styles applied to the component.
   */
  classes?: Partial<TypographyClasses> | undefined;
  /**
   * The color of the component.
   * It supports both default and custom theme colors, which can be added as shown in the
   * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
   */
  color?:
    | OverridableStringUnion<
        | 'primary'
        | 'secondary'
        | 'success'
        | 'error'
        | 'info'
        | 'warning'
        | `text${Capitalize<keyof TypeText>}`,
        TypographyPropsColorOverrides
      >
    | (string & {})
    | undefined;
  /**
   * If `true`, the text will have a bottom margin.
   * @default false
   */
  gutterBottom?: boolean | undefined;
  /**
   * If `true`, the text will not wrap, but instead will truncate with a text overflow ellipsis.
   *
   * Note that text overflow can only happen with block or inline-block level elements
   * (the element needs to have a width in order to overflow).
   * @default false
   */
  noWrap?: boolean | undefined;
  /**
   * The system prop that allows defining system overrides as well as additional CSS styles.
   */
  sx?: SxProps<Theme> | undefined;
  /**
   * Applies the theme typography styles.
   * @default 'body1'
   */
  variant?:
    | OverridableStringUnion<TypographyVariant | 'inherit', TypographyPropsVariantOverrides>
    | undefined;
  /**
   * The component maps the variant prop to a range of different HTML element types.
   * For instance, subtitle1 to `<h6>`.
   * If you wish to change that mapping, you can provide your own.
   * Alternatively, you can use the `component` prop.
   * @default {
   *   h1: 'h1',
   *   h2: 'h2',
   *   h3: 'h3',
   *   h4: 'h4',
   *   h5: 'h5',
   *   h6: 'h6',
   *   subtitle1: 'h6',
   *   subtitle2: 'h6',
   *   body1: 'p',
   *   body2: 'p',
   *   inherit: 'p',
   * }
   */
  variantMapping?:
    | Partial<
        Record<
          OverridableStringUnion<TypographyVariant | 'inherit', TypographyPropsVariantOverrides>,
          string
        >
      >
    | undefined;
}

export interface TypographyTypeMap<
  AdditionalProps = {},
  RootComponent extends React.ElementType = 'span',
> {
  props: AdditionalProps & TypographyOwnProps;
  defaultComponent: RootComponent;
}

declare const Typography: OverridableComponent<TypographyTypeMap>;

export type TypographyProps<
  RootComponent extends React.ElementType = TypographyTypeMap['defaultComponent'],
  AdditionalProps = {},
> = OverrideProps<TypographyTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
  component?: React.ElementType | undefined;
};
```

## 安装后验收

执行严格类型检查、生产构建和实际交互。检查键盘标签／焦点、原生支持的禁用／错误／只读语义、深浅色、窄屏和减少动画。按真实宿主数据检查回调，不把复制提示词当作安装完成。初始化工具还需检查服务端 HTML 与无告警水合。

## 来源与许可

https://github.com/mui/material-ui/tree/809a7717b4c050ba3f69b75300689f07c050a16e

MIT · @mui/material@9.4.0. 保留上游原始内容与许可证。上游完整原文保留于 vendor/docs，不标为全文中文化。

---

JGuang 全部资源索引: https://jiguang132.com/llms.txt
