Repository Public MIT
1# GlassBreadcrumb23| | |4|---|---|5| Identifier | `glass-breadcrumb` |6| Module | `SPGlassNavigation` |7| Kind | `custom-glass` — a navigation bar drawn with `glassSurface(_:in:)`, opaque with Reduce Transparency |8| Platforms | iOS 26, iPadOS 26, macOS 26 |9| Example | `Examples/Gallery/Navigation/GlassBreadcrumbExample.swift` |1011## Minimal usage1213```swift14GlassBreadcrumb([15 GlassBreadcrumbItem(id: "root", title: "Home", systemImage: "house"),16 GlassBreadcrumbItem(id: "docs", title: "Documents"),17 GlassBreadcrumbItem(id: "2026", title: "2026"),18]) { id in19 navigate(to: id)20}21```2223## Variants2425| Variant | Use |26|---|---|27| `maxVisibleItems: 4` (default) | Root, overflow menu, then the three levels closest to the current location. |28| `maxVisibleItems: 2` | Root, overflow menu, current location. |29| `maxVisibleItems: 1` | Overflow menu and current location only. |30| `systemImage:` | A symbol before the title of a level. |3132When the bar is narrower than its content, it shows fewer levels (down to one) before it truncates any title.3334## Parameters3536| Parameter | Type | Default | Meaning |37|---|---|---|---|38| `items` | `[GlassBreadcrumbItem<ID>]` | — | Path from the root to the current location. An empty path draws nothing. |39| `maxVisibleItems` | `Int` | `4` | Largest number of levels shown at once. |40| `onSelect` | `@MainActor (ID) -> Void` | — | Called with the identifier of the activated level, visible or in the menu. |4142## States4344The last item is the current location: stronger text, the selected trait and the accessibility value "Current location". The other levels are plain buttons. Hidden levels live in a menu labelled with their number ("3 hidden levels"). The layout is the pure type `GlassBreadcrumbLayout(count:maxVisible:)`.4546## Advanced example4748```swift49@State private var path: [Folder]5051GlassBreadcrumb(path.map { GlassBreadcrumbItem(id: $0.id, title: $0.name) }, maxVisibleItems: 3) { id in52 if let index = path.firstIndex(where: { $0.id == id }) {53 path.removeSubrange((index + 1)...)54 }55}56.safeAreaPadding(.horizontal)57```5859## Accessibility6061- The bar is a container labelled "Breadcrumb"; each level is a button whose label is its title.62- The current location is exposed by a trait and a value, not only by its weight and colour.63- Separators are hidden from assistive technologies.64- Every level and the menu are reachable with the keyboard (Tab or Full Keyboard Access) and have the platform's minimum hit target.65- Titles use theme fonts and follow Dynamic Type; a single remaining level truncates in the middle.6667## Limits6869- One glass surface for the whole bar; levels are not individual glass surfaces.70- The bar is never tinted, whatever the theme's glass tint: it carries text in the theme's text colours, which a tinted glass (Aurora, Neon) made illegible in 1.0.71- Activating the current location also calls `onSelect`; ignore it if it means nothing in your application.72- The path is always written from the root; in right-to-left languages the row is mirrored by the system.73- Very long paths rely on the overflow menu; the bar does not scroll.74- Visual result and keyboard traversal were not checked on a running device here.75