Fragiola

API: components

Breadcrumbs

The APG breadcrumb, a named navigation of links to the parent pages, the current one marked, its middle collapsing into a Menu, in each framework.

The trail of links to the parent pages of the current page, before the main content. It is the APG breadcrumb: a navigation landmark you name, an ordered list of links, aria-current="page" on the current page. A long trail collapses its middle into an Ellipsis you open as a Menu.

Router-linked breadcrumb
Gallery

Behaviour

  • Links: Breadcrumbs' Link is Link: current and disabled, and your router's link through render (React), as (Vue) or on its anchor (Angular).
  • Current page: a Link with current, or a Current (no link) with aria-current="page".
  • Separators: list items hidden from assistive technology (aria-hidden="true"), so the list holds only list items and a reader counts only the pages.
  • Collapsed middle: the Ellipsis is a native button you name and compose with a Menu's trigger (React render={<Menu.Trigger />}, Vue :as="Menu.Trigger", Angular menuTrigger on the same button); the Menu's items are your links. Breadcrumbs never imports Menu.
  • Keyboard: the browser's Tab through the links; the Menu's keys once open.

Anatomy

partelementdata-primitives-partrole
Rootnavbreadcrumbs-rootthe landmark
Listolbreadcrumbs-listthe trail
Itemlibreadcrumbs-itemone page of the trail
Linkabreadcrumbs-linka parent page (Link's behaviour)
Currentspanbreadcrumbs-currentthe current page when it is no link
Separatorlibreadcrumbs-separatorbetween two Items, hidden
Ellipsisbuttonbreadcrumbs-ellipsisthe collapsed middle, a Menu's trigger

Usage

import { Breadcrumbs } from "@fragiola/primitives-react/breadcrumbs";

<Breadcrumbs.Root aria-label="Breadcrumb">
    <Breadcrumbs.List>
        <Breadcrumbs.Item>
            <Breadcrumbs.Link href="/">Home</Breadcrumbs.Link>
        </Breadcrumbs.Item>
        <Breadcrumbs.Separator>/</Breadcrumbs.Separator>
        <Breadcrumbs.Item>
            <Breadcrumbs.Link href="/docs" current>
                Docs
            </Breadcrumbs.Link>
        </Breadcrumbs.Item>
    </Breadcrumbs.List>
</Breadcrumbs.Root>;

Props

Every part also takes what the primitive contract gives: render (Vue: as and the render slot), a class and a style, a ref, and any attribute, which it forwards.

Root

No props of its own; name it with aria-label.

List

No props of its own.

Item

No props of its own.

proptypedefaultdescription
currentbooleanfalseit links to the current page: aria-current="page"
disabledbooleanfalseunavailable, as Link's

Current

No props of its own.

Separator

No props of its own; its children are your separator.

Ellipsis

No props of its own; name it, and compose it with a Menu's trigger.

State and part attributes

partattributes
Linkaria-current="page" and data-current when current; aria-disabled="true" and data-disabled when disabled
Currentaria-current="page"
Separatoraria-hidden="true"
Ellipsistype="button"; the Menu's attributes when composed

Keyboard

The browser's: Tab and Shift+Tab move through the links and the Ellipsis, Enter follows a link, Enter or Space opens the Ellipsis's Menu, whose keys then apply.

Exports

entryexports
@fragiola/primitives-react/breadcrumbsBreadcrumbs, BreadcrumbsCurrentProps, BreadcrumbsEllipsisProps, BreadcrumbsItemProps, BreadcrumbsLinkProps, BreadcrumbsLinkState, BreadcrumbsListProps, BreadcrumbsRootProps, BreadcrumbsSeparatorProps, RenderProp
@fragiola/primitives-vue/breadcrumbsBreadcrumbs, BreadcrumbsLinkProps, BreadcrumbsLinkState, RenderSlotProps
@fragiola/primitives-angular/breadcrumbsBreadcrumbsCurrent, BreadcrumbsEllipsis, BreadcrumbsItem, BreadcrumbsLink, BreadcrumbsLinkState, BreadcrumbsList, BreadcrumbsRoot, BreadcrumbsSeparator