@oge-ui/navigation
v1.1.10
Published
Signal-based Angular navigation family: OgeTreeView with flat or nested data and APG treeview keyboard support, OgeDrawer whose modality follows its layout mode, OgeStepper with async leave guards, OgeMenubar — a WAI-ARIA APG menubar with nested submenus
Downloads
994
Maintainers
Readme
@oge-ui/navigation
Navigation controls for the OGE UI suite (Angular and React) — this is the Angular package. Signal-based, standalone, zoneless-ready, MIT.
Today the package ships OgeTreeView, OgeDrawer, OgeStepper,
OgeMenubar, OgeBreadcrumb and OgePagination.
npm install @oge-ui/navigationTree View
<oge-tree-view [items]="folders" keyExpr="id" parentIdExpr="parentId" displayExpr="name" selectionMode="multiple" showCheckBoxes="normal" [(expandedKeys)]="open" [(selectedKeys)]="picked" />Nested payloads work just as well — point itemsExpr at the children field
and the parent links are derived:
<oge-tree-view [items]="tree" itemsExpr="children" displayExpr="name" />What it does
- Either data shape — a flat parent-referencing array or nested children,
normalized by
@oge-ui/core's tree engine into one pipeline. - Accessibility — the WAI-ARIA APG treeview pattern: a roving tabindex over
role="treeitem"rows,Down/Up,Right/Leftwith the proper open/first-child and close/parent semantics,Home/End, type-ahead and*to expand a level. Multi-select addsSpace,Shift+Arrow,Ctrl+Shift+Home/EndandCtrl+A. - Flat DOM — depth is carried by
aria-level/aria-posinset/aria-setsizerather than nestedrole="group"wrappers. The APG sanctions this, and it is what makes virtualization possible. - Tri-state checkboxes — checking cascades down to descendants and
normalizes up, so a parent is checked only when every child is. Report the
result as
all,leavesOnlyorexcludeRecursiveviaselectedKeysMode. - Search — accent- and locale-insensitive, auto-expands the ancestors of a match so it is reachable, and highlights the matched substring.
- Lazy load on demand —
loadChildrenfetches a node's children on first expand behind a placeholder row; fetched children join the index, so cascading selection reaches them. - Virtual scrolling — windowed rendering for very large trees, built on
core's
OffsetTree; keyboard focus scrolls the target into view first. - Drag & drop — drop
inside,beforeoraftera node, with a cycle guard, hover-to-expand and Escape to cancel. The tree emitsitemReorderedand leaves the data change to you. - Theming — the shared
--oge-*design tokens, logical properties for RTL, andprefers-reduced-motionsupport.
See the API reference for the full surface.
Drawer
<oge-drawer [(opened)]="menuOpen" mode="side" [size]="240" [compactBelow]="720" ariaLabel="Sections">
<oge-tree-view ogeDrawerPanel [items]="nav" />
<router-outlet />
</oge-drawer>One component, not the container/drawer/content trio the reference libraries
need: the panel is the [ogeDrawerPanel] slot, everything else projected is
the content.
What it does
- Three layout modes —
overlayfloats over the content,pushshifts it aside without resizing it,sideshrinks it so both share the row. Four logical edges (start/end/top/bottom), so RTL needs no flag. - Modality is derived from
mode, never configured.overlayandpushcover or displace the content, so they are dialogs:role="dialog",aria-modal, a focus trap, Escape, andinerton the background.sideshares the row, so it is a landmark (navigation/complementary/region) with none of those. WAI-ARIA has no drawer pattern and conditions modality on background interaction actually being blocked — an independent flag is exactly what lets a panel claimrole="complementary"andaria-modal="true"at once. - Compact rail —
minSizeis the closed size, so asidedrawer can collapse to an icon rail instead of a gap, and stay keyboard reachable. - Responsive to its own container —
compactBelowmeasures the drawer's own box, never the window, so a drawer nested in a dialog or a split pane adapts to the room it actually has. The rule is core's pureresolveDrawerMode(). - One Escape stack — the drawer registers with the same overlay stack every other OGE surface uses, so a popup opened inside it closes before it does.
- Safe areas — the panel pads itself with
env(safe-area-inset-*), so it clears notches and home indicators on mobile devices. - Chrome — an optional
showCloseButton, adisabledswitch that blocks the open/close gestures without disabling the panel's content, andtoggle(force?)for driving the drawer from a router or a media query. - Async
closeGuard—false, a throw and a rejection all veto the close; a promise reportsclosePending, and a second gesture meanwhile is dropped.
See the API reference for the full surface.
Stepper
<oge-stepper [(activeIndex)]="step" [linear]="true" [showNavigation]="true">
<oge-step label="Account" [completed]="accountValid()">…</oge-step>
<oge-step label="Shipping" [optional]="true">…</oge-step>
<oge-step label="Review">…</oge-step>
</oge-stepper>Steps come from projected children, from a data-driven steps array, or both
(children first).
What it does
- Accessibility, decided rather than inherited — there is no WAI-ARIA APG
stepper pattern, so this is an ordered list of
<button>headers carryingaria-current="step", each body arole="region"labelled by its header. One semantic in both orientations: Angular Material instead emits atablistwhen horizontal andaria-currentwhen vertical, so the same widget reads as two different things to a screen reader. A tablist also claims panels may be browsed freely — exactly whatlinearforbids. - Keyboard — the headers are buttons in a list, so they are all Tab-reachable
with no roving tabindex to get in the way.
keyboardNavigationadds arrow/Home/End as an enhancement; it moves focus only, and does not wrap, because a process does not loop from the last step to the first. - Linear flow —
linearblocks moving past a step that is neithercompletednoroptional,editable: falseblocks coming back, and every refusal emitsstepBlockedwith the reason. Material refuses silently. - Async
stepGuard—false, a throw and a rejection all veto; a promise reportschangePending, a second gesture meanwhile is dropped, and the guard gates the finish on the last step too. - Navigation — a built-in Back / Next bar via
showNavigation(none of the three references ships one), plus[ogeStepperNext]/[ogeStepperPrevious]directives that work inside the stepper or bound to it from outside. - Lazy content —
deferRenderingcreates a body on first activation,keepAlivekeeps it mounted afterwards.
Inside a form, <oge-form-steps> wraps this component and derives each step's
completion from the form's own error rollup — identically in all three binding
modes — and touches only the step being left, so the steps ahead stay quiet.
See the API reference for the full surface.
Menubar
<oge-menubar [items]="menu" (itemClick)="run($event)" />Items come from a data tree, from nested <oge-menubar-item> children, or both
(children first). Children at any depth open as nested submenus.
What it does
- The full WAI-ARIA APG menubar pattern —
role="menubar"with a roving tabindex,Left/Rightbetween items,Down/Enterinto a submenu (Upopens focusing the last item),Righton a leaf hopping to the next bar item with its menu open,Escapeunwinding one level at a time,Home/Endand accent-insensitive type-ahead. A vertical bar keeps the same roles witharia-orientation="vertical"and swapped axes. - Know when not to use it — the APG's own advice: for plain site
navigation, a
<nav>of links (optionally with the disclosure pattern) serves better than menubar semantics. This component is for application-style command menus. (Angular Material has no menubar at all —MatMenuis a button-triggered dropdown; the CDK'scdkMenuBaris the closest reference.) - Shared machinery, not a second menu — submenus at every depth are the
suite's canonical
oge-menu-listin an anchored panel on the one shared Escape stack, so a menubar submenu, a grid context menu and a drop-down button all behave — and can now all nest — identically. - Open mode without the knob forest —
openMode: 'click' | 'hover'governs the top level only; nested levels always open on hover (50/300 ms show/hide dwell) and onArrowRight/Enter, the reference libraries' first-vs-nested split baked in as behavior. - Responsive to its own container —
compactBelowmeasures the menubar's own box, never the window; below it the whole bar becomes one hamburger button opening the full tree as nested menus. The rule is core's pureresolveMenubarCompact(). - Router-friendly without a router dependency —
urlitems render as real links,activeKeymarks the current item witharia-current="page", anditemClick(with its hierarchicalpath) is where navigation happens. - Cancelable pipeline —
submenuOpening/submenuClosingcarry the house mutablecancelflag;submenuOpened/submenuClosedreport, with the close reason. - Accelerators and badges —
shortcutrenders a right-aligned hint announced viaaria-keyshortcuts(no reference menu renders accelerator text at all; the actual key binding stays the application's),badgeadds a counter pill — both live on the canonicalOgeMenuItem, so every menu in the suite gained them.
See the API reference for the full surface.
Breadcrumb
<oge-breadcrumb [items]="trail" (itemClick)="go($event)" />Crumbs come from a flat data trail, from <oge-breadcrumb-item> children, or
both (children first).
What it does
- The WAI-ARIA APG breadcrumb, verbatim — a
<nav>landmark holding an ordered list of real links, the current page carryingaria-current="page"and never interactive, separatorsaria-hiddendecoration. The APG defines no keyboard behavior for a breadcrumb, so none is invented: crumbs are plain links in the Tab order, with no roving tabindex. (Neither DevExtreme nor Angular Material/CDK ships a breadcrumb at all — the parity references are Kendo and PrimeNG.) - Container-width collapse that loses nothing —
collapseMode: 'auto'(default) measures the breadcrumb's own box, never the window, and collapses the oldest middle crumbs first; first and last always stay visible. Unlike the references, the collapsed crumbs stay reachable: the ellipsis button opens them as real links in the suite's shared menu. The fitting arithmetic is core's purefitToolbarItems— the same kernel the toolbar's overflow uses.'wrap'breaks onto rows,'none'keeps one scrollable row. - Router-friendly without a router dependency —
urlcrumbs render as real<a href>(middle-click and copy-address work);preventDefault()initemClickhands navigation to a router.itemClickcarries{ item, key, index, event }and never fires for disabled crumbs or the last crumb. - Templates that cannot break the semantics —
[ogeBreadcrumbItemTemplate]replaces the crumb's interior only (link/current/disabled elements stay with the component);[ogeBreadcrumbSeparatorTemplate]renders inside thearia-hiddenseparator. - Config —
provideOgeBreadcrumbConfig(); the nav landmark's label and the ellipsis button's label live inOgeBreadcrumbMessages.
See the API reference for the full surface.
Pagination
<oge-pagination [(pageIndex)]="page" [itemCount]="total" [pageSize]="20" />What it does
- A constant-width numeric window with real ellipsis markers — ellipsis
slots count toward
maxButtons(default 7), so paging from the first page through the middle to the last never changes how many slots render and the bar never jitters. An ellipsis never hides a single page (the page renders instead). The window arithmetic is core's pureresolvePageWindow. - The grid pager's contracts, kept aligned by design —
pageIndexis 0-based and two-way;pageSize: 0means "all items on one page";pageSizesaccepts'all'.pageChanged/pageSizeChangedfire only on user interaction withpreviousPageIndex/previousPageSize; programmatic writes and auto-clamps update the models silently. - Unknown totals, written down — omit
itemCountand only prev/next plus a "Page N" indicator render; next never disables because the component cannot know the end (clamppageIndexat the app level when the server reports the last page). - Composed accessibility — no APG pagination pattern exists, so the
markup composes a
<nav>landmark named by messages, real buttons witharia-current="page"on the active page and the info range in anaria-live="polite"region. Keyboard is the native Tab order. - Adaptive against its own container —
displayMode: 'adaptive'swaps to the compactN / Mindicator belowcompactBelow(default 480px), measured by ResizeObserver against the bar's own box, never the window. - Config —
provideOgePaginationConfig(); every string incl. the info template ({from}–{to} of {itemCount}) lives inOgePaginationMessages.
See the API reference for the full surface.
For AI coding assistants
The complete machine-readable API reference ships inside the package at
node_modules/@oge-ui/navigation/llms.txt — conventions, every documented member
and copy-pasteable demos in one file. Online: https://www.ogeui.com/llms.txt (index)
and https://www.ogeui.com/llms-full.txt (the whole suite).
License
MIT
