LedgerUI.Components.Breadcrumb (LedgerUI v0.2.0)

Copy Markdown View Source

The trail of pages above the current one; the last :item is the current page.

<.breadcrumb>
  <:item navigate={~p"/customers"}>Customers</:item>
  <:item>Casa das Tintas</:item>
</.breadcrumb>

An item with href, navigate or patch is a link; one with phx-click is a link-looking button; the others are plain text. nil/false destinations count as absent. Any other attr of the item (phx-target, phx-value-*, id, data-*, aria-*) goes to the link.

max_items collapses a long trail: it keeps the first step and the last max_items - 2, and the ones in between become a "…" button opening a dropdown/1 (id "#{id}-more").

The last step is rendered with aria-current="page"; the "…" trigger is a role="button" with aria-label, aria-haspopup, aria-expanded and aria-controls (from dropdown/1).

variant is canvas, plain or bordered. The default is nil: the base lu-crumb look, which is the canvas one without the extra pill classes. The :separator slot replaces the default /.

Additions to the README: the item attr icon (an icon drawn before the step, outside the link) and style (on the current step, or on a span wrapping a link and its separator, for staggered animations).

Summary

Functions