Sidebar
Config-driven layout chrome: pin/unpin on desktop, slide-in drawer on mobile, nested submenus, a choice of top- or bottom-positioned mobile navbar, and a full custom-event surface. Everything below is driven by a single PHP $sidebar array.
Config shape
The sidebar partial expects one scoped $sidebar array. Every consumer-level option — nav structure, brand, footer actions, current page, mobile toggle position — lives here.
Navigation items
Each navigation section has a title and an items array. An item is either a leaf (has url) or a parent (has children). Parents nest to any depth and render recursively.
Mobile navbar position
Resize the browser below 992px to see the current variant in action. This page is configured with mobileToggle: 'bottom', so the entire navbar — including the hamburger — moves to the bottom edge of the viewport. Dropdowns inside the navbar flip upward.
Event surface
Every sidebar interaction bubbles a CustomEvent up to document. The table below lists each event and its detail payload.
| Event | When | Detail |
|---|---|---|
lp:sidebar:init | After constructor (base Component) | — |
lp:sidebar:ready | After active path expanded & scrolled into view | — |
lp:sidebar:toggle | Before open/close branch (mobile only) | { willOpen: bool } |
lp:sidebar:open | Start of mobile drawer open | — |
lp:sidebar:opened | End of open transition | — |
lp:sidebar:close | Start of mobile drawer close | — |
lp:sidebar:closed | End of close transition | — |
lp:sidebar:pin | Pin state toggled (desktop, Ctrl+B) | { pinned: bool } |
lp:sidebar:item:expand | Submenu opened | { element, key, depth } |
lp:sidebar:item:collapse | Submenu closed | { element, key, depth } |
lp:sidebar:item:click | Leaf link clicked (observability only) | { element, key, url } |
Programmatic toggle: dispatch lp:sidebar:toggle-request on document. The same event is fired by the bottom hamburger button and the legacy lp:navbar:toggle-sidebar event is still honoured for back-compat.
Live event log
Interact with the real sidebar on the left — click any item, open/close a submenu, press Ctrl+B to toggle pin, or tap the bottom hamburger on a narrow viewport. Every event appears here in real time.