Skip to content

Breadcrumb

A breadcrumb displays the current location within a hierarchy. It allows going back to states higher up in the hierarchy.

When To Use

  • When the system has more than two layers in a hierarchy.
  • When you need to inform the user of where they are.
  • When the user may need to navigate back to a higher level.

Examples

Basic

vue
<template>
  <a-breadcrumb>
    <a-breadcrumb-item>Home</a-breadcrumb-item>
    <a-breadcrumb-item><a href="">Application Center</a></a-breadcrumb-item>
    <a-breadcrumb-item><a href="">Application List</a></a-breadcrumb-item>
    <a-breadcrumb-item>An Application</a-breadcrumb-item>
  </a-breadcrumb>
</template>

With Icon

vue
<template>
  <a-breadcrumb>
    <a-breadcrumb-item>
      <template #icon>
        <HomeOutlined />
      </template>
    </a-breadcrumb-item>
    <a-breadcrumb-item>
      <template #icon>
        <UserOutlined />
      </template>
      <span>Application List</span>
    </a-breadcrumb-item>
    <a-breadcrumb-item>Application</a-breadcrumb-item>
  </a-breadcrumb>
</template>

<script setup>
import { HomeOutlined, UserOutlined } from '@ant-design/icons-vue'
</script>

Configuring the Separator

vue
<template>
  <div>
    <a-breadcrumb separator=">">
      <a-breadcrumb-item>Home</a-breadcrumb-item>
      <a-breadcrumb-item href="">Application Center</a-breadcrumb-item>
      <a-breadcrumb-item href="">Application List</a-breadcrumb-item>
      <a-breadcrumb-item>An Application</a-breadcrumb-item>
    </a-breadcrumb>
    <br />
    <a-breadcrumb>
      <template #separator>
        <span style="color: red">*</span>
      </template>
      <a-breadcrumb-item>Home</a-breadcrumb-item>
      <a-breadcrumb-item href="">Application Center</a-breadcrumb-item>
      <a-breadcrumb-item href="">Application List</a-breadcrumb-item>
      <a-breadcrumb-item>An Application</a-breadcrumb-item>
    </a-breadcrumb>
  </div>
</template>

With Dropdown menu

vue
<template>
  <a-breadcrumb>
    <a-breadcrumb-item>Ant Design Vue</a-breadcrumb-item>
    <a-breadcrumb-item>
      <a href="">Component</a>
    </a-breadcrumb-item>
    <a-breadcrumb-item :overlay="menu">
      <a href="">General</a>
    </a-breadcrumb-item>
    <a-breadcrumb-item>Button</a-breadcrumb-item>
  </a-breadcrumb>
</template>

<script setup>
import { h } from 'vue'

const menu = h('a-menu', {}, [
  h('a-menu-item', { key: '1' }, [
    h('a', { href: '' }, 'General')
  ]),
  h('a-menu-item', { key: '2' }, [
    h('a', { href: '' }, 'Layout')
  ]),
  h('a-menu-item', { key: '3' }, [
    h('a', { href: '' }, 'Navigation')
  ])
])
</script>

API

PropertyDescriptionTypeDefaultVersion
itemRenderCustom item renderer(route, params, routes, paths) => VNode-
paramsRouting parametersobject-
routesThe routing stack information of routerroutes[]-
separatorCustom separatorstring | slot/
PropertyDescriptionTypeDefaultVersion
hrefTarget of hyperlinkstring-
overlayThe dropdown menuMenu | () => Menu-
PropertyDescriptionTypeDefaultVersion
-Custom separator--

When using Breadcrumb.Separator,its parent component must be set to separator="", otherwise the default separator of the parent component will appear.

Released under the MIT License.