Skip to content

NavigationPane

NavigationPane uses the same controlled NavigationItem model as NavigationBar, but lays destinations out vertically.

const bool expanded = UseViewportClass() == ViewportClass::Expanded;
NavigationPane(
{
NavigationItem(images::home, "Home"),
NavigationItem(images::settings, "Settings"),
},
selected,
expanded
).OnChanged([selected](std::size_t index) {
selected = index;
})

The third constructor argument is expanded and defaults to false. Compact mode behaves like a navigation rail; expanded mode exposes a wider label-oriented pane. Responsiveness remains explicit application composition rather than a hidden component rewrite.

Selection is controlled and updates through NavigationEvents::Changed. NavigationPaneStyle owns compact and expanded widths, item geometry, content colors, indication, and selection animation.

Both visual modes publish the same Navigation collection. Each destination is a labelled semantic button with stable selected and disabled state, so changing expanded does not replace its accessible identity.

  • NavigationPane(items, selected_index, bool expanded = false) with initializer-list/vector and value/state overloads.
  • OnChanged(handler) receives the requested index.
  • Uses NavigationBar’s NavigationItem values.

See also DrawerLayout and responsive interfaces.

Declared in <huxerui/navigation.h>. Both modes accept the same initializer-list/vector and index/State constructor forms. The expanded argument changes presentation only; it does not mean a modal drawer is open. To put destinations in a dismissible or responsive side region, place the pane in StartDrawer and let DrawerLayout own that region’s presentation.

NavigationPaneStyle fields Use
background, label_style, selected_content, disabled_content Pane and destination colors/typography.
compact_width, expanded_min_width Preferred compact width and expanded minimum width.
item_height, item_margin, item_padding Row height, outer spacing, and content inset.
icon_size, icon_spacing Icon geometry and label gap.
indicator, compact_indicator_size, indicator_corner_radius Selected surface; compact mode uses an icon-sized indicator.
indication, selection_animation State feedback and selection motion.

Keep the pane background transparent when it should share a drawer’s surface. Copying a Flat style wholesale into a Material drawer also replaces its typography and geometry; prefer changing just the inherited fields you need.