logoAnt Design

⌘ K
  • 设计
  • 研发
  • 组件
  • 博客
  • 资源
  • 国内镜像
5.25.2
  • 组件总览
  • 通用
    • Button按钮
    • FloatButton悬浮按钮
      5.0.0
    • Icon图标
    • Typography排版
  • 布局
    • Divider分割线
    • Flex弹性布局
      5.10.0
    • Grid栅格
    • Layout布局
    • Space间距
    • Splitter分隔面板
      5.21.0
  • 导航
    • Anchor锚点
    • Breadcrumb面包屑
    • Dropdown下拉菜单
    • Menu导航菜单
    • Pagination分页
    • Steps步骤条
    • Tabs标签页
  • 数据录入
    • AutoComplete自动完成
    • Cascader级联选择
    • Checkbox多选框
    • ColorPicker颜色选择器
      5.5.0
    • DatePicker日期选择框
    • Form表单
    • Input输入框
    • InputNumber数字输入框
    • Mentions提及
    • Radio单选框
    • Rate评分
    • Select选择器
    • Slider滑动输入条
    • Switch开关
    • TimePicker时间选择框
    • Transfer穿梭框
    • TreeSelect树选择
    • Upload上传
  • 数据展示
    • Avatar头像
    • Badge徽标数
    • Calendar日历
    • Card卡片
    • Carousel走马灯
    • Collapse折叠面板
    • Descriptions描述列表
    • Empty空状态
    • Image图片
    • List列表
    • Popover气泡卡片
    • QRCode二维码
      5.1.0
    • Segmented分段控制器
    • Statistic统计数值
    • Table表格
    • Tag标签
    • Timeline时间轴
    • Tooltip文字提示
    • Tour漫游式引导
      5.0.0
    • Tree树形控件
  • 反馈
    • Alert警告提示
    • Drawer抽屉
    • Message全局提示
    • Modal对话框
    • Notification通知提醒框
    • Popconfirm气泡确认框
    • Progress进度条
    • Result结果
    • Skeleton骨架屏
    • Spin加载中
    • Watermark水印
      5.1.0
  • 其他
    • Affix固钉
    • App包裹组件
      5.1.0
    • ConfigProvider全局化配置
    • Util工具类
      5.13.0

Breadcrumb
面包屑

显示当前页面在系统层级结构中的位置,并能向上返回。
使用import { Breadcrumb } from "antd";
源码components/breadcrumb
文档
编辑此页更新日志

相关资源

Ant Design X
Ant Design Charts
Ant Design Pro
Pro Components
Ant Design Mobile
Ant Design Mini
Ant Design Web3
Ant Design Landing-首页模板集
Scaffolds-脚手架市场
Umi-React 应用开发框架
dumi-组件/文档研发工具
qiankun-微前端框架
Ant Motion-设计动效
国内镜像站点 🇨🇳

社区

Awesome Ant Design
Medium
Twitter
yuque logoAnt Design 语雀专栏
Ant Design 知乎专栏
体验科技专栏
seeconf logoSEE Conf-蚂蚁体验科技大会
加入我们

帮助

GitHub
更新日志
常见问题
报告 Bug
议题
讨论区
StackOverflow
SegmentFault

Ant XTech logo更多产品

yuque logo语雀-构建你的数字花园
AntV logoAntV-数据可视化解决方案
Egg logoEgg-企业级 Node.js 框架
Kitchen logoKitchen-Sketch 工具集
Galacean logoGalacean-互动图形解决方案
xtech logo蚂蚁体验科技
主题编辑器
Made with ❤ by
蚂蚁集团和 Ant Design 开源社区
开发
设计

何时使用

  • 当系统拥有超过两级以上的层级结构时;
  • 当需要告知用户『你在哪里』时;
  • 当需要向上导航的功能时。
jsx
// >=5.3.0 可用,推荐的写法 ✅
return <Breadcrumb items={[{ title: 'sample' }]} />;
// <5.3.0 可用,>=5.3.0 时不推荐 🙅🏻‍♀️
return (
<Breadcrumb>
<Breadcrumb.Item>sample</Breadcrumb.Item>
</Breadcrumb>
);
// 或
return <Breadcrumb routes={[{ breadcrumbName: 'sample' }]} />;

代码演示

  1. Home
  2. /
  3. Application Center
  4. /
  5. Application List
  6. /
  7. An Application
基本

最简单的用法。

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
  1. Users
  2. /
  3. 1
带有参数的

带有路由参数的。

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
  1. Ant Design
  2. /
  3. Component
  4. /
  5. General
  6. /
  7. Button
带下拉菜单的面包屑

面包屑支持下拉菜单。

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
  1. Home
  2. /
  3. User
Debug Routes

原 routes 调试。

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
  1. /
  2. Application List
  3. /
  4. Application
带有图标的

图标放在文字前面。

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
  1. Home
  2. >
  3. Application Center
  4. >
  5. Application List
  6. >
  7. An Application
分隔符

使用 separator=">" 可以自定义分隔符。

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code
  1. Location
  2. :
  3. Application Center
  4. /
  5. Application List
  6. /
  7. An Application
独立的分隔符

自定义单独的分隔符。

CodeSandbox Icon
codepen icon
External Link Icon
expand codeexpand code

API

通用属性参考:通用属性

Breadcrumb

参数说明类型默认值版本
itemRender自定义链接函数,和 react-router 配置使用(route, params, routes, paths) => ReactNode-
params路由的参数object-
items路由栈信息items[]-5.3.0
separator分隔符自定义ReactNode/

ItemType

type ItemType = Omit<RouteItemType, 'title' | 'path'> | SeparatorType

RouteItemType

参数说明类型默认值版本
className自定义类名string-
dropdownProps弹出下拉菜单的自定义配置Dropdown-
href链接的目的地,不能和 path 共用string-
path拼接路径,每一层都会拼接前一个 path 信息。不能和 href 共用string-
menu菜单配置项MenuProps-4.24.0
onClick单击事件(e:MouseEvent) => void-
title名称ReactNode-5.3.0

SeparatorType

ts
const item = {
type: 'separator', // Must have
separator: '/',
};
参数说明类型默认值版本
type标记为分隔符separator5.3.0
separator要显示的分隔符ReactNode/5.3.0

和 browserHistory 配合

和 react-router 一起使用时,默认生成的 url 路径是带有 # 的,如果和 browserHistory 一起使用的话,你可以使用 itemRender 属性定义面包屑链接。

jsx
import { Link } from 'react-router';
const items = [
{
path: '/index',
title: 'home',
},
{
path: '/first',
title: 'first',
children: [
{
path: '/general',
title: 'General',
},
{
path: '/layout',
title: 'Layout',
},
{
path: '/navigation',
title: 'Navigation',
},
],
},
{
path: '/second',
title: 'second',
},
];
function itemRender(currentRoute, params, items, paths) {
const isLast = currentRoute?.path === items[items.length - 1]?.path;
return isLast ? (
<span>{currentRoute.title}</span>
) : (
<Link to={`/${paths.join('/')}`}>{currentRoute.title}</Link>
);
}
return <Breadcrumb itemRender={itemRender} items={items} />;

主题变量(Design Token)

组件 Token如何定制?
Token 名称描述类型默认值
iconFontSize图标大小number14
itemColor面包屑项文字颜色stringrgba(0,0,0,0.45)
lastItemColor最后一项文字颜色stringrgba(0,0,0,0.88)
linkColor链接文字颜色stringrgba(0,0,0,0.45)
linkHoverColor链接文字悬浮颜色stringrgba(0,0,0,0.88)
separatorColor分隔符颜色stringrgba(0,0,0,0.45)
separatorMargin分隔符外间距number8
全局 Token如何定制?