Navigation breadcrumbs for terminal UIs
Push / pop navigation items to build breadcrumbs. Track a stack of visited locations — useful for file explorers, menu trees, and shell history.
composer require sugarcraft/sugar-crumbs
use SugarCraft\Crumbs\{NavStack, NavigationItem};
$nav = new NavStack();
$nav = $nav->push(new NavigationItem('Home', '/'));
$nav = $nav->push(new NavigationItem('Settings', '/settings'));
$nav = $nav->push(new NavigationItem('Display', '/settings/display'));
echo $nav->view(); // Home / Settings / Display
$nav = $nav->pop(); // back to Settings
| Class | Method | Description |
|---|---|---|
| NavStack | new() | Create navigation stack |
| NavStack | push(item) | Push navigation item |
| NavStack | pop() | Pop navigation item |
| NavStack | view() | Render breadcrumbs |
| NavStack | filter(query) | Filter breadcrumbs |
| NavigationItem | new(label, path) | Create navigation item |
| Breadcrumb | withZoneManager(?Manager) | Attach Manager for mouse-click zone tracking (candy-zone integration) |
| Breadcrumb | setSeparator(string) | Set separator between crumbs |
| Breadcrumb | setMaxWidth(int) | Truncate if total width exceeds limit |
| Breadcrumb | render(NavStack) | Render NavStack as breadcrumb string |
VHS-recorded GIFs of every example shipped with the library. Regenerated automatically on every push that touches the source.