Skip to main content

CamoBreadcrumb

Concept​

1. Why​

A breadcrumb shows where you are in a hierarchy and lets you go up it: a folder path, a category trail (Fluent and Carbon's Breadcrumb, macOS path controls). The last item is the current location. When the trail is too long, the middle collapses into an overflow menu.

2. Shape​

Split of duties

CoreSkin (renderer)
the items, measuring and collapsing the middle into a menu (the toolbar's fit logic and CamoMenuAnchor), separators, keys (Left and Right, Home, End), semantics (navigation, the current item)the item look (link or text), the separator, the overflow button, spacing

Material mapping preview: the M3 has none.

  • bodyMedium links in primary, the current item onSurface, a chevron separator.

3. API​

Contract​

data class CamoBreadcrumbItem(
val key: Any,
val label: String,
val icon: Slot? = null,
val onClick: (() -> Unit)? = null, // null: not a link
)

fun CamoBreadcrumb(
items: List<CamoBreadcrumbItem>, // root first; the last is the current location
maxVisible: Int? = null, // null: collapse only when it doesn't fit
label: String = "Breadcrumb",
)

State → renderer: BreadcrumbItemState(current, link, interaction), SeparatorState; the overflow is a ghost icon button from the skin plus CamoMenuAnchor. Slots: label, icon.

Tokens used​

  • colors.primary (link), onSurface (current), onSurfaceVariant (separator)
  • typography.bodyMedium; spacing.xs

Component theme​

theme.components.breadcrumb. Every field is nullable in the theme. The skin's defaults(theme) fills whatever isn't set (Material defaults shown). See Theme §3.10.

FieldTypeMaterial defaultWhat it's for
separatorIconSourcechevron rightmirrors in RTL
itemPaddingDp4
overflowIconIconSourcemore
colorsBreadcrumbColors(link, current, separator, hover)M3 valuesevery color it uses
stringsBreadcrumbStringsEnglish"More", "current page"

Accessibility​

  • A navigation landmark named label; links are buttons, the current item is announced "current page" and is not a button.
  • One Tab stop; Left and Right move, Enter activates, the overflow opens with Enter or Down.

4. Build steps​

  1. CamoBreadcrumbItem, the fit (reusing the toolbar's pure function), theme, state, renderer, the CamoSkin field.
  2. CamoBreadcrumb, the DebugSkin renderer.
  3. Tests: collapsing and the menu items, maxVisible, keys, RTL, semantics.

Done when

  • The admin sample's file tree has a breadcrumb that collapses on narrow windows.

5. Edge cases​

CaseDecided behavior
CaseDecided behavior
------
One itemJust the current item.
A very long labelIt ellipsizes; the first and last items keep at least a minimum width.
RTLOrder and separators mirror.
Changed in the M10 build (2026-11-02)
  • The renderer has Container, Item and Separator; the overflow is the skin's ghost icon button with a CamoMenuAnchor. BreadcrumbColors(link, current, separator, hover); items are at least 48 tall for touch.
  • The fit is one pure function (planBreadcrumb): everything when it fits (and within maxVisible), else the first item, the overflow and as many of the last items as fit. Below that shortest form the end is clipped. The current item is not a link and announces "current page".
  • Not built: built-in strings and per-item tooltips. Flutter measures the labels with TextPainter in the ambient style (the current item semibold), keeps 8 px of slack and has no intrinsic size; a skin that adds more padding than itemPadding per item can make the estimate short.
  • Which items collapse: the middle ones, keeping the first and the last two; say if you prefer only the last.

Implementation​

1. Why​

A SubcomposeLayout measures the items and decides what collapses, like the toolbar.

2. Shape​

3. API​

@Composable public fun CamoBreadcrumb(items: List<CamoBreadcrumbItem>, modifier: Modifier = Modifier,
maxVisible: Int? = null, label: String = "Breadcrumb")

4. Build steps​

  1. Layout, items, overflow, renderer.
  2. Tests: collapsing, keys, semantics.

Done when

  • Works by touch, mouse, keyboard and screen reader on all targets.

5. Edge cases​

CaseDecided behavior
MeasuringThe collapse needs the items' widths; they are measured once per label change.
Changed in the M10 build (2026-11-02)
  • A SubcomposeLayout measures silent copies of the items (their semantics cleared), then composes only what shows; the roving focus covers the shown parts.
  • None specific.