Components/Breadcrumb

Breadcrumb

A trail of links showing the current page's place in a hierarchy.

VerifiedSince 0.3.4

Usage

Items with href render as native links; other interactive items render as buttons and emit click.

Loading demo...

Separator Icon

<template>
  <TxBreadcrumb :items="items" separator-icon="i-carbon-caret-right" />
</template>

Best Practices

  • Order items from the broadest parent to the current page.
  • Use href for real routes so native link behavior, such as the context menu and copy link, still works.
  • Reserve items without href for virtual levels that need custom behavior; href links never emit click.
  • Keep labels short: they describe the hierarchy, not the full page title.
  • Don't disable the current item; the last item is already non-interactive.

API Reference

Props

PropTypeDefaultDescription
itemsBreadcrumbItem[]requiredOrdered entries; the last one is the current page.
separatorIconstring'i-carbon-chevron-right'Icon between entries.

Events

EventPayloadDescription
click(item: BreadcrumbItem, index: number)Fires for an enabled, non-current item without href.

Types

BreadcrumbItem, one entry of items:

FieldTypeDescription
labelstringVisible text.
hrefstringNative link target; ignored for the current and disabled items.
iconstringTxIcon name shown before the text.
disabledbooleanBlocks interaction and sets aria-disabled.

Overview

  • The root is <nav aria-label="Breadcrumb"> around an ordered list.
  • The last item renders as <span aria-current="page"> and stays inert even with href.
  • Other enabled items render as <a> with href, using native navigation, or as <button> without it.
  • Disabled items render as <span aria-disabled="true"> and emit nothing.
  • Separators appear only between items and are aria-hidden.
  • Icon names are i--prefixed icon classes, such as i-carbon-home.

Technologies

  • Source: packages/tuffex/packages/components/src/breadcrumb/.
查看源码
packages/tuffex/packages/components/src/breadcrumb/index.ts