IndexedPages
IndexedPages keeps every page mounted but measures and presents only the selected one. Use it when a tab or destination switch should retain each page’s local state without swipe gestures or page-transition motion.
Controlled example
Section titled “Controlled example”#include <huxerui/huxerui.h>
#include <cstddef>
using namespace huxerui;
[[huxerui::composable]]View Workspace() { auto selected = UseState<std::size_t>(0); return Column { Row { Button("Overview").OnClick([selected] { selected = 0; }), Button("Activity").OnClick([selected] { selected = 1; }), }, IndexedPages({Text("Overview"), Text("Activity")}, selected), };}Contract
Section titled “Contract”Declared by <huxerui/view.h>. Constructors accept an initializer list or vector of Views plus a selected index or State<std::size_t>. The page list must be nonempty and the index valid.
Offscreen retention is not disposal: lifecycle-owned work can remain active. Stop expensive work based on your application’s selected-page state when necessary. Preserve stable page identity when pages reorder.
The owner changes the index; there is no user-driven change event. Use Pager for swiping and transition motion, and NavigationStack for push/pop history.
Retention versus selection
Section titled “Retention versus selection”The four overloads combine initializer_list<View> or vector<View> with std::size_t or const State<std::size_t>&. No page factory or deferred loading is implied: the supplied pages are retained together. An empty page list and an out-of-range index are invalid configuration.
Only the selected page contributes the presented layout. Changing to a taller page can change the container’s intrinsic height; constrain the content area if the outer shell should stay stable. Offscreen page state survives selection changes, but removing a page ends its lifetime. Pass the selected state to pages whose work should pause while hidden. IndexedPages has no separate style, animation configuration, or OnChanged event.

