UI / WIDGETS / Navigation
Pagination
Move through paginated data
Run the Xu example ↗The example executes in the browser using the Xu/WASM runtime.
What to try
Switch pages and observe the current page number.
Usage notes
Keep page count, current page and page size synchronized with the data. Pagination requests a change; the application loads the data.
Create through Screen
The Screen constructor returns a node ID. Pass that ID to Screen layout, state and event APIs. It is separate from the standalone control object documented below.
Native Xu setup fragment: call configure during initialization of an existing Screen. See the complete example for window creation, event dispatch and cleanup.
#ui/widgets
fn configure(screen $&widgets.Screen) int {
id := screen.pagination(4,0) or >>
screen.place(id,24.0,24.0,320.0,80.0) or >>
<< id
}
Placement, state and events
The application owns the component. Screen.place positions nodes; Screen.set_enabled and Screen.set_visible control availability and visibility. Present again after state changes, handle or errors, and keep topology changes outside paint callbacks. ToastHost uses its own queue API.
Action · Styles · UI lifecycle and styling guide
Screen.place · Screen.set_enabled · Screen.set_visible
Standalone control object API
These types and methods support applications that manage control objects, input and painting directly. Their receiver is a control object, not a Screen node ID. For Screen usage, use the constructor above and the Screen methods in the Widgets module.
Complete native example
Component Workshop · Back to Widgets