Skip to content

View and component API

Declared by <huxerui/view.h>.

Copy-on-write declarative value. Public rvalue-qualified operations are OnClick(handler), On<Key>(handler), LayoutValue<Key>(value), With(modifiers...), and Key(...). Key overloads accept signed/unsigned integers, other integral types, enums, strings, string views, and C strings. Explicit boolean conversion reports whether a view contains a spec.

Views is a dynamic child collection with Reserve, Add, Size, Items, and rvalue Take. ForEach(range, factory) and the State<Range> overload build it. Containers accept View and Views children, and component factories retain copyable arguments when an API defers their invocation.

Layout<Derived> creates a custom layout node with children and a static Measure. VirtualLayout<Derived> creates a lazy layout from either (range, factory) or (item_count, factory). The framework owns the erased item source and layout descriptor.

Each linked component page documents constructors, controlled values, events, fluent methods, theme behavior, semantics, and examples.

View is a transient copy-on-write declaration. The Runtime owns mounted identity, retained extensions, focus, scrolling, text sessions, and animation; do not retain a View as mutable UI state. Rvalue-qualified methods return the configured value, which keeps component declarations linear and prevents accidental mutation of a shared lvalue.

Required component values belong in constructors. Application-owned text, selection, checked state, selected index, progress, and declarative visibility are controlled values: pass the current value and publish the requested next value from the typed event. Use stable .Key(...) values for dynamic stateful siblings that insert, remove, or reorder.