App Nav Layout for Vaadin Flow - Vaadin Add-on Directory
An adaptive desktop/tablet/phone navigation sidebar layout for Vaadin applications
`AppNavLayout` is a mobile-friendly base layout for your Vaadin application. By default, it automatically generates your application's navigation menus from the `@Menu`, `@Route`, and `@PageTitle` annotations on your views. Out of the box, it uses a bottom touch bar on phones, a side rail on tablets, and a `SideNav` drawer on desktops. If you don't like any default, you can change it. For instance, if you prefer alternative titles, icons, or hierarchy than supplied by the defaults, you can provide your own replacement suppliers. And if need be, you can provide an entirely different menu system for any device/orientation combination.
## Feature list
### Automatic
- **Device-adaptive nav chrome** — a bottom touch bar on phones, a permanent side rail on tablets (both orientations), and a `SideNav` drawer on desktop, switched to automatically based on touch capability and screen size.
- **Live re-evaluation** — rotating a device, resizing a split-screen window, or any other viewport change re-picks the right nav type in place, with no page reload.
- **Nav tree derived from your routes** — the entire nav tree comes from the `@Route`/`@Menu` metadata your views already declare; add, move, or rename a view and every nav surface (bar, rail, drawer) picks it up with no separate wiring.
- **Automatic grouping** — sibling routes sharing a first path segment (e.g. `catalog/products`, `catalog/categories`) are grouped under an auto-labeled section with no group annotation of their own.
- **Overflow handling** — when more root sections exist than fit a touch bar or rail, the excess collapses into a "More" popover automatically.
- **Drill-down secondary nav** — nested routes get a two-level tab bar with a back button on touch/rail, kept in sync with the current route.
- **Active-item highlighting** — the current route's nav item is highlighted consistently across all three nav types.
- **Adaptive per-view header** — a view can contribute an icon+title (desktop) or an action component (desktop and mobile) to a header slot that reassembles itself on every navigation, via `HasViewHeaderTitle`/`HasViewHeaderComponent`.
- **Theme-adaptive styling** — active nav items pick up whichever Vaadin theme is actually loaded (Lumo, Aura, or a properly authored custom theme) automatically, rather than a hardcoded color.
- **Safe-area aware** — bar/rail icon capacity accounts for device notches, rounded corners, and home indicators, so nothing renders under an unsafe strip.
### Customizable
- **Custom icon/title/grouping** — drive labels, icons, and grouping from your own annotations instead of `@Menu`, via `setViewIconGenerator`/`setViewTitleGenerator`/`setViewNavGroupResolver`.
- **Custom grouping strategy** — replace `PathPrefixNavGrouper` entirely with your own `NavGrouper`.
- **Custom active-item matching** — override path matching for touch/rail highlighting (`setNavPathMatcher`), or nested-route match behavior for desktop `SideNav` highlighting (`setNavMatchNested`).
- **Per-scenario renderers** — independently swap the `NavRenderer` for any of the five device/orientation scenarios, or set both orientations of tablet/phone at once.
- **Partial overrides** — subclass a built-in renderer to change just one behavior, e.g. `createOverflowComponent()` to replace the "More" popover with a chevron or swipeable strip.
- **Custom `SideNavItem` rendering** — override `setNavNodeRenderer` for full control of the desktop drawer's item appearance.
- **Configurable breakpoint** — adjust the physical-screen-size threshold that distinguishes tablet from phone (`setTabletMinShortSidePx`).
- **Lifecycle hook** — react to nav-type changes via `onNavTypeChanged`/`NavTypeChangedEvent`.
- **Escape hatch** — `addToNavbar()` for direct `AppLayout` access when nothing else fits.
See the README.md on [GitHub](https://github.com/joelpop/vaadin-flow-app-nav-layout) for many more details.
View on GitHub
App Nav Layout for Vaadin Flow version 25.1.0
App Nav Layout for Vaadin Flow version 25.1.1
Added alternative layouts for each device type.
App Nav Layout for Vaadin Flow version 25.1.2
Bug-fix release for the phone touch bar and the Expanding touch bar variant. No API changes.
- Removed hidden internal padding/margin on nav items and chevron buttons that was inflating their height past their actual icon+label
content, leaving unwanted dead space above the swipe-gesture area at the bottom of the screen.
- Removed a minimum-height floor on the touch bar that no longer served any purpose once items sized correctly to their own content.
- Fixed a layout conflict between the touch bar's default spacing and the Expanding touch bar's own positioning needs, exposed by the
fix above.
- Fixed the Expanding touch bar's collapsed overflow section reserving spacing it didn't need while collapsed.
- Replaced that section's reveal animation with one that tracks its real content height instead of animating toward a guessed fixed
target, fixing a visible desync between the section growing and its spacing opening.
No public API changed in this release.
App Nav Layout for Vaadin Flow version 25.1.3
New: setNavItemFilter(Predicate) lets you exclude individual views from the nav tree — for permission checks,
device-specific views, or any other per-view condition. Returns true to include an entry, false to exclude it; defaults to including
everything. Re-evaluated on every nav rebuild, so it's safe to base on session-scoped state like the current user's roles.
Excluding every entry under a nav group removes the group too — a group only ever exists in the tree as a side effect of a real entry
beneath it, so an empty one simply doesn't get created.
Applies uniformly across every nav surface: touch bar, side rail, desktop SideNav drawer, and the flyout-rail and header-tabs
alternative renderers.
See the README's new "Excluding nav items" section for a role-based example.