生态产品多个设计器现已发布候选版本

查看生态总览
Skip to content

Breadcrumb ​

Navigation component. This page is the API reference, generated from the source code. Usage guidance and live examples are on the Chinese page.

Anatomy ​

Parts in bold are required.

data-scope="breadcrumb": root · list · item · link · link-icon · separator · ellipsis · ellipsis-trigger

API reference ​

Descriptions of individual props, events and slots are written in Chinese and appear on the Chinese page.

Artifacts ​

LayerValue
Custom element<xh-breadcrumb>
Vue componentsXhBreadcrumbEllipsis XhBreadcrumbEllipsisTrigger XhBreadcrumbItem XhBreadcrumbLink XhBreadcrumbLinkIcon XhBreadcrumbList XhBreadcrumbRoot XhBreadcrumbSeparator
ComposableuseBreadcrumb
State machinebreadcrumbMachine
Skin@xihan-ui/styles/breadcrumb.css

Props ​

PropTypeRequired
collectionreadonly BreadcrumbNode[]
maxItemsnumber
dirDirection
translationsPartial<BreadcrumbTranslations>
toneTone
sizeSize

Elements of collection.

FieldTypeRequired
valuestringYes
labelstring
hrefstring
iconstring
currentboolean

React adapter props ​

Only the props each component declares itself: DOM attributes inherited from ComponentPropsWithRef are left out, and root props already listed in the Props table are not repeated. The Vue counterpart is the slot table above.

React componentPropTypeRequired
XhBreadcrumbLinkvaluestring
XhBreadcrumbLinkcurrentboolean
XhBreadcrumbRootrenderSeparator() => ReactNode
XhBreadcrumbRootrenderEllipsis(nodes: readonly BreadcrumbNodeMeta[]) => ReactNode

State ​

The following names are internal to the state machine.

States: idle

Events: PRESS.START · PRESS.END · EXPAND

Guards: canPress

connect API ​

getXxxProps() returns the host attributes of the matching part.

MemberType
collectionreadonly BreadcrumbNodeMeta[]
itemsreadonly BreadcrumbItem[]
expandedboolean
expand() => void
collapsedRange(count: number) => BreadcrumbCollapsedRange | null
getRootProps() => T['element']
getListProps() => T['element']
getItemProps() => T['element']
getLinkProps(props: BreadcrumbLinkProps) => T['element']
getLinkIconProps() => T['element']
getSeparatorProps() => T['element']
getEllipsisProps() => T['element']
getEllipsisTriggerProps() => T['button']

Accessibility ​

Keyboard ​

Specification: W3C APG. Each row is a stable behavior id that the conformance tests cover; the conditions and effects are described on the Chinese page.

KeysBehavior
Enterbreadcrumb.kbd.link
Enter / Spacebreadcrumb.kbd.press
Enter / Spacebreadcrumb.kbd.expand
Tab / Shift+Tabbreadcrumb.kbd.tab

ARIA ​

These attributes are produced by connect.

PartAttributeValue
rootaria-labeltranslations.root
linkaria-current'page' | undefined
linkaria-disabled'true' | 'false'
link-iconaria-hidden'true'
separatoraria-hidden'true'
ellipsis-triggeraria-labeltranslations.ellipsis

Style reference ​

Skin ​

@xihan-ui/styles/breadcrumb.css is written against [data-scope="breadcrumb"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-breadcrumb in place of data-scope (same specificity) and sits in the xihan.components layer. Put overrides in xihan.overrides; the part selectors work as usual.

Data attributes ​

Produced by connect; valueless attributes are omitted while their condition does not hold.

PartAttributeValue
rootdata-sizeprops.size
rootdata-toneprops.tone
linkdata-current'' (present only while the condition holds)
linkdata-pressed'' (present only while the condition holds)
linkdata-xh-collection-context'nav'
linkdata-xh-collection-item''
linkdata-xh-collection-sizeprops.size
linkdata-xh-collection-terminal'' (present only while the condition holds)
ellipsis-triggerdata-xh-collection-context'nav'
ellipsis-triggerdata-xh-collection-item''
ellipsis-triggerdata-xh-collection-sizeprops.size

CSS variables ​

The public override slots, generated from what the standalone skin actually consumes.

VariablePartCSS propertyStateDefault from
--xh-breadcrumb-ellipsis-sizeellipsismin-inline-sizedefault--xh-space-5
--xh-breadcrumb-ellipsis-trigger-hellipsis-triggermin-block-sizedefault--xh-breadcrumb-link-h
--xh-breadcrumb-fgellipsis-trigger
link
root
colordefault
xh-collection-context=nav
--xh-fg-muted
--xh-breadcrumb-font-sizeellipsis-trigger
link
root
font-sizedefault--xh-_breadcrumb-font-size
--xh-breadcrumb-gaplistgapdefault--xh-_breadcrumb-gap
--xh-breadcrumb-icon-sizeellipsis-trigger
link
root
--xh-icon-sizedefault--xh-glyph-size-text
--xh-breadcrumb-leadingellipsis-trigger
link
root
line-heightdefault--xh-leading-tight
--xh-breadcrumb-link-bg-hoverlinkbackground-colordisabled
error
hover
not([aria-disabled='true'], [data-disabled], [aria-busy='true'], [data-error])
xh-collection-context=nav
--xh-bg-subtle
--xh-breadcrumb-link-bg-pressedlinkbackground-colordisabled
error
is(:active, [data-pressed])
not([aria-disabled='true'], [data-disabled], [aria-busy='true'], [data-error])
pressed
xh-collection-context=nav
--xh-bg-subtle-hover
--xh-breadcrumb-link-fg-currentlinkcolorcurrent
xh-collection-context=nav
xh-collection-terminal
--xh-_breadcrumb-accent-text
--xh-breadcrumb-link-fg-hoverlinkcolordisabled
error
hover
not([aria-disabled='true'], [data-disabled], [aria-busy='true'], [data-error])
xh-collection-context=nav
--xh-_tone-fg
--xh-breadcrumb-link-fg-pressedlinkcolordisabled
error
is(:active, [data-pressed])
not([aria-disabled='true'], [data-disabled], [aria-busy='true'], [data-error])
pressed
xh-collection-context=nav
--xh-_tone-fg
--xh-breadcrumb-link-font-weight-currentlinkfont-weightcurrent
xh-collection-context=nav
xh-collection-terminal
--xh-font-weight-medium
--xh-breadcrumb-link-gaplinkgapdefault--xh-space-1
--xh-breadcrumb-link-hellipsis-trigger
link
min-block-sizedefault--xh-control-action-size
--xh-breadcrumb-link-icon-sizelink-iconblock-size
inline-size
default--xh-glyph-size-text
--xh-breadcrumb-link-max-wlinkmax-inline-sizedefault--xh-nav-link-max-w
--xh-breadcrumb-link-pxlinkpadding-inlinedefault--xh-space-1
--xh-breadcrumb-link-radiuslinkborder-radiusdefault--xh-shape-control
--xh-breadcrumb-separator-fgellipsis
separator
colordefault--xh-fg-disabled
--xh-breadcrumb-separator-sizeseparatorinline-sizedefault--xh-glyph-size-text

Released under The MIT License